/** * Copies all elements of the parsed Iterator to a {@link HashSet}. * To use other Set implementations that {@link HashSet} you can use * {@link #addToSet(Iterator, Set)} * @param <T> the generic type of the returned set * @param it the Iterator with elements compatible to T * @return the set containing all elements of the iterator * @throws IllegalArgumentException if the parsed {@link Iterator} is <code>null</code> */ public static <T> Set<T> asSet(Iterator<? extends T> it){ if(it == null){ throw new IllegalArgumentException("The parsed Iterator MUST NOT be NULL!"); } return addToSet(it, new HashSet<T>()); } /**
/** * Copies all elements of the parsed Iterator to a {@link HashSet}. * To use other Set implementations that {@link HashSet} you can use * {@link #addToSet(Iterator, Set)} * @param <T> the generic type of the returned set * @param it the Iterator with elements compatible to T * @return the set containing all elements of the iterator * @throws IllegalArgumentException if the parsed {@link Iterator} is <code>null</code> */ public static <T> Set<T> asSet(Iterator<? extends T> it){ if(it == null){ throw new IllegalArgumentException("The parsed Iterator MUST NOT be NULL!"); } return addToSet(it, new HashSet<T>()); } /**