static Set asSet(O[] array) { new HashSet set; for (O o : array) if (o != null) set.add(o); ret set; } static Set asSet(S[] array) { new TreeSet set; for (S o : array) if (o != null) set.add(o); ret set; } static Set asSet(Iterable l) { if (l instanceof Set) ret (Set) l; new HashSet set; for (A o : unnull(l)) if (o != null) set.add(o); ret set; } ifclass MultiSet // Note: does not clone the set (keeps multiset alive) static Set asSet(MultiSet ms) { ret ms == null ? null : ms.asSet(); } endif