/** * Returns a set that maintains the order of elements that are added * backed by the given set. * <p> * If an element is added twice, the order is determined by the first add. * The order is observed through the iterator or toArray. * * @param set the set to order, must not be null * @return an ordered set backed by the given set * @throws IllegalArgumentException if the Set is null */ public static Set orderedSet(Set set) { return ListOrderedSet.decorate(set); }
/** * Returns a set that maintains the order of elements that are added * backed by the given set. * <p> * If an element is added twice, the order is determined by the first add. * The order is observed through the iterator or toArray. * * @param set the set to order, must not be null * @return an ordered set backed by the given set * @throws IllegalArgumentException if the Set is null */ public static Set orderedSet(Set set) { return ListOrderedSet.decorate(set); }
public Set makeEmptySet() { return ListOrderedSet.decorate(new HashSet()); }
public void testDecorator() { try { ListOrderedSet.decorate((List) null); fail(); } catch (IllegalArgumentException ex) {} try { ListOrderedSet.decorate((Set) null); fail(); } catch (IllegalArgumentException ex) {} try { ListOrderedSet.decorate(null, null); fail(); } catch (IllegalArgumentException ex) {} try { ListOrderedSet.decorate(new HashSet(), null); fail(); } catch (IllegalArgumentException ex) {} try { ListOrderedSet.decorate(null, new ArrayList()); fail(); } catch (IllegalArgumentException ex) {} }
/** * Returns a set that maintains the order of elements that are added * backed by the given set. * <p> * If an element is added twice, the order is determined by the first add. * The order is observed through the iterator or toArray. * * @param set the set to order, must not be null * @return an ordered set backed by the given set * @throws IllegalArgumentException if the Set is null */ public static Set orderedSet(Set set) { return ListOrderedSet.decorate(set); }
/** * Returns a set that maintains the order of elements that are added * backed by the given set. * <p> * If an element is added twice, the order is determined by the first add. * The order is observed through the iterator or toArray. * * @param set the set to order, must not be null * @return an ordered set backed by the given set * @throws IllegalArgumentException if the Set is null */ public static Set orderedSet(Set set) { return ListOrderedSet.decorate(set); }
/** * Returns a set that maintains the order of elements that are added * backed by the given set. * <p> * If an element is added twice, the order is determined by the first add. * The order is observed through the iterator or toArray. * * @param set the set to order, must not be null * @return an ordered set backed by the given set * @throws IllegalArgumentException if the Set is null */ public static Set orderedSet(Set set) { return ListOrderedSet.decorate(set); }
/** * Returns a set that maintains the order of elements that are added * backed by the given set. * <p> * If an element is added twice, the order is determined by the first add. * The order is observed through the iterator or toArray. * * @param set the set to order, must not be null * @return an ordered set backed by the given set * @throws IllegalArgumentException if the Set is null */ public static Set orderedSet(Set set) { return ListOrderedSet.decorate(set); }
/** * Returns a set that maintains the order of elements that are added * backed by the given set. * <p> * If an element is added twice, the order is determined by the first add. * The order is observed through the iterator or toArray. * * @param set the set to order, must not be null * @return an ordered set backed by the given set * @throws IllegalArgumentException if the Set is null */ public static Set orderedSet(Set set) { return ListOrderedSet.decorate(set); }
/** * Returns a set that maintains the order of elements that are added * backed by the given set. * <p> * If an element is added twice, the order is determined by the first add. * The order is observed through the iterator or toArray. * * @param set the set to order, must not be null * @return an ordered set backed by the given set * @throws IllegalArgumentException if the Set is null */ public static Set orderedSet(Set set) { return ListOrderedSet.decorate(set); }
/** * Returns a set that maintains the order of elements that are added * backed by the given set. * <p> * If an element is added twice, the order is determined by the first add. * The order is observed through the iterator or toArray. * * @param set the set to order, must not be null * @return an ordered set backed by the given set * @throws IllegalArgumentException if the Set is null */ public static Set orderedSet(Set set) { return ListOrderedSet.decorate(set); }
private static Set createListOrderedSet(int initialCapacity) { return ListOrderedSet.decorate(new HashSet(initialCapacity)); }
protected void deduplicate(List<Object> toDedupe) { // De-duplication doesn't actually work correctly if we just pass toModifyValues into the decoration... Set<Object> uniqueValues = ListOrderedSet.decorate(new ArrayList<Object>(toDedupe.size())); uniqueValues.addAll(toDedupe); toDedupe.clear(); toDedupe.addAll(uniqueValues); } }