List of usage examples for com.google.common.collect AbstractIterable AbstractIterable
AbstractIterable
From source file:com.proxiad.emfcustomizer.ecss.util.Iterables2.java
/** * Take a generic Iterable<T> and sort out all duplicates from this * Iterable<T>//from w ww. j av a 2 s . co m * * @param <T> * @param input * @return un Iterable<T> gnrique en retirant les doublons */ public static <T> Iterable<T> unique(final Iterable<T> input) { Iterable<T> unique = new AbstractIterable<T>() { public Iterator<T> iterator() { final Set<T> set = new HashSet<T>(); return Iterators.filter(input.iterator(), new Predicate<T>() { public boolean apply(T input) { return set.add(input); } }); } }; return unique; }