List of usage examples for org.apache.commons.collections4.functors UniquePredicate UniquePredicate
public UniquePredicate()
From source file:com.link_intersystems.lang.reflect.criteria.ClassCriteria.java
/** * Sets the selected {@link ClassType}s of the class hierarchy in the order * they are selected. Default is {@link ClassType#CLASSES}, * {@link ClassType#INTERFACES}./* w w w .ja v a 2 s . c om*/ * * @param classTypes * the {@link ClassType}s of the class hierarchy that should be * selected when iterating through the hierarchy. The classTypes * should be unique. Otherwise the first occurrence in the * classTypes array wins. All later occurrences will be ignored. * @since 1.2.0.0 */ public void setSelection(ClassType... classTypes) { Assert.notNull("classTypes", classTypes); List<ClassType> uniqueClassTypes = new ArrayList<ClassType>(Arrays.asList(classTypes)); CollectionUtils.filter(uniqueClassTypes, new UniquePredicate()); this.classTypes = (ClassType[]) uniqueClassTypes.toArray(new ClassType[uniqueClassTypes.size()]); }
From source file:com.link_intersystems.lang.reflect.criteria.ClassCriteria.java
@SuppressWarnings("unchecked") protected Iterator<Class<?>> applyTraverseClassesUniquely(Iterator<Class<?>> iterator) { if (isTraverseClassesUniquelyEnabled()) { iterator = IteratorUtils.filteredIterator(iterator, UniquePredicate.uniquePredicate()); }/* w ww . ja v a2 s. com*/ return iterator; }