src/org/kocakosm/pitaya/collection/Iterators.java
public static <E> Bag<E> toBag(Iterator<? extends E> iterator)
	{
		return new ArrayBag<E>(iterator);
	}
public static <E> Bag<E> toBag(Iterator<? extends E> iterator)
	{
		return new ArrayBag<E>(iterator);
	}
Returns a {@code Bag} containing all the given {@code Iterator}'s
elements. The returned {@code Bag} has the same iteration order as
the given {@code Iterator}. This method consumes entirely the input
{@code Iterator}.

@param <E> the type of the returned {@code Bag}'s elements.
@param iterator the {@code Iterator} to consume.

@return the {@code Bag} created from the given {@code Iterator}.

@throws NullPointerException if {@code iterator} is {@code null}.