private static <T>List<T> asList(Set<T> a,Set<T> b){
  if (a == null || b == null || a.isEmpty() || b.isEmpty()) {
    return Collections.<T>emptyList();
  }
  if (a.size() < b.size()) {
    List<T> c=new ArrayList<T>(a);
    c.retainAll(b);
    return c;
  }
 else {
    List<T> c=new ArrayList<T>(b);
    c.retainAll(a);
    return c;
  }
}

private static < T > List < T > asList ( Set < T > a , Set < T > b ) { if ( a == null || b == null || a . isEmpty ( ) || b . isEmpty ( ) ) { return Collections . < T > emptyList ( ) ; } if ( a . size ( ) < b . size ( ) ) { List < T > c = new ArrayList < T > ( a ) ; c . retainAll ( b ) ; return c ; } else { List < T > c = new ArrayList < T > ( b ) ; c . retainAll ( a ) ; return c ; } }
intersects 2 sets and returns the result as a list
