/** * Returns a transformed set backed by the given set. * <p> * Each object is passed through the transformer as it is added to the * Set. It is important not to use the original set after invoking this * method, as it is a backdoor for adding untransformed objects. * * @param set the set to transform, must not be null * @param transformer the transformer for the set, must not be null * @return a transformed set backed by the given set * @throws IllegalArgumentException if the Set or Transformer is null */ public static Set transformedSet(Set set, Transformer transformer) { return TransformedSet.decorate(set, transformer); }
/** * Factory method to create a transforming set. * <p> * If there are any elements already in the set being decorated, they * are NOT transformed. * * @param set the set to decorate, must not be null * @param transformer the transformer to use for conversion, must not be null * @throws IllegalArgumentException if set or transformer is null */ public static Set decorate(Set set, Transformer transformer) { return new TransformedSet(set, transformer); }
/** * Returns a transformed set backed by the given set. * <p> * Each object is passed through the transformer as it is added to the * Set. It is important not to use the original set after invoking this * method, as it is a backdoor for adding untransformed objects. * * @param set the set to transform, must not be null * @param transformer the transformer for the set, must not be null * @return a transformed set backed by the given set * @throws IllegalArgumentException if the Set or Transformer is null */ public static Set transformedSet(Set set, Transformer transformer) { return TransformedSet.decorate(set, transformer); }
/** * Factory method to create a transforming set. * <p> * If there are any elements already in the set being decorated, they * are NOT transformed. * * @param set the set to decorate, must not be null * @param transformer the transformer to use for conversion, must not be null * @throws IllegalArgumentException if set or transformer is null */ public static Set decorate(Set set, Transformer transformer) { return new TransformedSet(set, transformer); }
public Set makeEmptySet() { return TransformedSet.decorate(new HashSet(), TestTransformedCollection.NOOP_TRANSFORMER); }
/** * Factory method to create a transforming set. * <p> * If there are any elements already in the set being decorated, they * are NOT transformed. * * @param set the set to decorate, must not be null * @param transformer the transformer to use for conversion, must not be null * @throws IllegalArgumentException if set or transformer is null */ public static Set decorate(Set set, Transformer transformer) { return new TransformedSet(set, transformer); }
public Set uniqueSet() { Set set = getBag().uniqueSet(); return TransformedSet.decorate(set, transformer); }
/** * Factory method to create a transforming set. * <p> * If there are any elements already in the set being decorated, they * are NOT transformed. * * @param set the set to decorate, must not be null * @param transformer the transformer to use for conversion, must not be null * @throws IllegalArgumentException if set or transformer is null */ public static Set decorate(Set set, Transformer transformer) { return new TransformedSet(set, transformer); }
public Set uniqueSet() { Set set = getBag().uniqueSet(); return TransformedSet.decorate(set, transformer); }
/** * Factory method to create a transforming set. * <p> * If there are any elements already in the set being decorated, they * are NOT transformed. * * @param set the set to decorate, must not be null * @param transformer the transformer to use for conversion, must not be null * @throws IllegalArgumentException if set or transformer is null */ public static Set decorate(Set set, Transformer transformer) { return new TransformedSet(set, transformer); }
public Set makeFullSet() { Set list = new HashSet(); list.addAll(Arrays.asList(getFullElements())); return TransformedSet.decorate(list, TestTransformedCollection.NOOP_TRANSFORMER); }
/** * Factory method to create a transforming set. * <p> * If there are any elements already in the set being decorated, they * are NOT transformed. * * @param set the set to decorate, must not be null * @param transformer the transformer to use for conversion, must not be null * @throws IllegalArgumentException if set or transformer is null */ public static Set decorate(Set set, Transformer transformer) { return new TransformedSet(set, transformer); }
public void testTransformedSet() { Set set = TransformedSet.decorate(new HashSet(), TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); assertEquals(0, set.size()); Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"}; for (int i = 0; i < els.length; i++) { set.add(els[i]); assertEquals(i + 1, set.size()); assertEquals(true, set.contains(new Integer((String) els[i]))); assertEquals(false, set.contains(els[i])); } assertEquals(false, set.remove(els[0])); assertEquals(true, set.remove(new Integer((String) els[0]))); }
/** * Factory method to create a transforming set. * <p> * If there are any elements already in the set being decorated, they * are NOT transformed. * * @param set the set to decorate, must not be null * @param transformer the transformer to use for conversion, must not be null * @throws IllegalArgumentException if set or transformer is null */ public static Set decorate(Set set, Transformer transformer) { return new TransformedSet(set, transformer); }
/** * Returns a transformed set backed by the given set. * <p> * Each object is passed through the transformer as it is added to the * Set. It is important not to use the original set after invoking this * method, as it is a backdoor for adding untransformed objects. * * @param set the set to transform, must not be null * @param transformer the transformer for the set, must not be null * @return a transformed set backed by the given set * @throws IllegalArgumentException if the Set or Transformer is null */ public static Set transformedSet(Set set, Transformer transformer) { return TransformedSet.decorate(set, transformer); }
/** * Returns a transformed set backed by the given set. * <p> * Each object is passed through the transformer as it is added to the * Set. It is important not to use the original set after invoking this * method, as it is a backdoor for adding untransformed objects. * * @param set the set to transform, must not be null * @param transformer the transformer for the set, must not be null * @return a transformed set backed by the given set * @throws IllegalArgumentException if the Set or Transformer is null */ public static Set transformedSet(Set set, Transformer transformer) { return TransformedSet.decorate(set, transformer); }
/** * Returns a transformed set backed by the given set. * <p> * Each object is passed through the transformer as it is added to the * Set. It is important not to use the original set after invoking this * method, as it is a backdoor for adding untransformed objects. * * @param set the set to transform, must not be null * @param transformer the transformer for the set, must not be null * @return a transformed set backed by the given set * @throws IllegalArgumentException if the Set or Transformer is null */ public static Set transformedSet(Set set, Transformer transformer) { return TransformedSet.decorate(set, transformer); }
/** * Returns a transformed set backed by the given set. * <p> * Each object is passed through the transformer as it is added to the * Set. It is important not to use the original set after invoking this * method, as it is a backdoor for adding untransformed objects. * * @param set the set to transform, must not be null * @param transformer the transformer for the set, must not be null * @return a transformed set backed by the given set * @throws IllegalArgumentException if the Set or Transformer is null */ public static Set transformedSet(Set set, Transformer transformer) { return TransformedSet.decorate(set, transformer); }
/** * Returns a transformed set backed by the given set. * <p> * Each object is passed through the transformer as it is added to the * Set. It is important not to use the original set after invoking this * method, as it is a backdoor for adding untransformed objects. * * @param set the set to transform, must not be null * @param transformer the transformer for the set, must not be null * @return a transformed set backed by the given set * @throws IllegalArgumentException if the Set or Transformer is null */ public static Set transformedSet(Set set, Transformer transformer) { return TransformedSet.decorate(set, transformer); }
/** * Returns a transformed set backed by the given set. * <p> * Each object is passed through the transformer as it is added to the * Set. It is important not to use the original set after invoking this * method, as it is a backdoor for adding untransformed objects. * * @param set the set to transform, must not be null * @param transformer the transformer for the set, must not be null * @return a transformed set backed by the given set * @throws IllegalArgumentException if the Set or Transformer is null */ public static Set transformedSet(Set set, Transformer transformer) { return TransformedSet.decorate(set, transformer); }