/** * Filters away all the duplicated items in the given iterable. * Note that this method accepts an Object in order to be used in conjunction with the {@link Lambda#forEach(Iterable)}. * @param iterable The iterable of objects to be filtered * @return A Collection with the same items of the given iterable but containing no duplicate elements */ public static <T> Collection<T> selectDistinct(Object iterable) { return selectDistinct(iterable, (Comparator<T>) null); }
/** * Filters away all the duplicated items in the given iterable. * @param iterable The iterable of objects to be filtered * @return A Collection with the same items of the given iterable but containing no duplicate elements */ public static <T> Collection<T> selectDistinct(Iterable<T> iterable) { return selectDistinct(iterable, (Comparator<T>) null); }
/** * Selects all the items in the given iterable having a different value in the named property. * Note that this method accepts an Object in order to be used in conjunction with the {@link Lambda#forEach(Iterable)}. * @param iterable The iterable of objects to be filtered * @param propertyName The name of the item's property on which the item must have no duplicated value * @return A Collection with the same items of the given iterable but containing no duplicate values on the named property */ public static <T> Collection<T> selectDistinct(Object iterable, String propertyName) { return selectDistinct(iterable, new PropertyComparator<T>(propertyName)); }
/** * Selects all the items in the given iterable having a different value on the given argument defined using the on method. * Note that this method accepts an Object in order to be used in conjunction with the {@link Lambda#forEach(Iterable)}. * @param iterable The iterable of objects to be filtered * @param argument An argument defined using the {@link Lambda#on(Class)} method * @return A Collection with the same items of the given iterable but containing no duplicate values on the given argument */ public static <T, A> Collection<T> selectDistinctArgument(Object iterable, A argument) { return selectDistinct(iterable, new ArgumentComparator<T, A>(argument)); }