code: public static <T> Collection<T> intersect(Collection<T> left, Collection<T> right) {
          if (left.isEmpty() || right.isEmpty())
              return createSimilarCollection(left, 0);
  
          if (left.size() < right.size()) {
              Collection<T> swaptemp = left;
              left = right;
              right = swaptemp;
          }
  
          // TODO optimise if same type?
          // boolean nlgnSort = sameType(new Collection[]{left, right});
  
          Collection<T> result = createSimilarCollection(left, left.size());
          //creates the collection to look for values.
          Collection<T> pickFrom = new TreeSet<T>(new NumberAwareComparator<T>());
          pickFrom.addAll(left);
  
          for (final T t : right) {
              if (pickFrom.contains(t))
                  result.add(t);
          }
          return result;
      }
docs: Create a Collection composed of the intersection of both collections.  Any
  elements that exist in both collections are added to the resultant collection.
  <pre class="groovyTestCase">assert [4,5] == [1,2,3,4,5].intersect([4,5,6,7,8])</pre>
  
  @param left  a Collection
  @param right a Collection
  @return a Collection as an intersection of both collections
  @since 1.5.6