Skip to content

Instantly share code, notes, and snippets.

@jbuda
Created April 8, 2013 11:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbuda/5336245 to your computer and use it in GitHub Desktop.
Save jbuda/5336245 to your computer and use it in GitHub Desktop.
<cfscript>
colourArray = ["Red","Orange","Yellow","Green","Blue","Indigo","Violet"];
colourArrayTwo = ["Yellow","Green","Red","Violet"];
// duplicate one array as the result of retainAll remove the elements no present in both
// we want to keep the original array and return a new array
presentInBoth = duplicate(colourArray);
presentInBoth.retainAll(colourArrayTwo);
writeDump(presentInBoth);
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment