Java TreeSet intersection(TreeSet AL1, TreeSet AL2)

Here you can find the source of intersection(TreeSet AL1, TreeSet AL2)

Description

intersection

License

Apache License

Declaration

public static TreeSet<String> intersection(TreeSet<String> AL1,
            TreeSet<String> AL2) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.TreeSet;

public class Main {
    public static TreeSet<String> intersection(TreeSet<String> AL1,
            TreeSet<String> AL2) {
        TreeSet<String> returnTreeSet = new TreeSet<String>();
        for (String test : AL1) {
            if (!returnTreeSet.contains(test)) {
                if (AL2.contains(test)) {
                    returnTreeSet.add(test);
                }//from  ww w.  jav a 2 s.c  om
            }
        }
        return returnTreeSet;
    }
}

Related

  1. findSizedSubdirs(final String size, final TreeSet themeSubdirs)
  2. getDockInsets(final TreeSet set)
  3. getTreeSet(Collection collection)
  4. getTreeSet(final Object o, final Class classElement)
  5. getVariance(TreeSet positions)
  6. minDiff(TreeSet numbers)
  7. newTreeSet(final Collection c)
  8. toTreeSet(Collection lines)
  9. toTreeSet(Collection collection, Comparator comparator)