public abstract class Iterator2Collection<T> extends Object implements Collection<T>
Iterator to a Collection. Note that if you just want to use Java 5's
for-each loop with an Iterator, use Iterator2Iterable.Iterator2Iterable| Constructor and Description |
|---|
Iterator2Collection() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(T arg0) |
boolean |
addAll(Collection<? extends T> arg0) |
void |
clear() |
boolean |
contains(Object arg0) |
boolean |
containsAll(Collection<?> arg0) |
boolean |
equals(Object o) |
protected abstract Collection<T> |
getDelegate() |
int |
hashCode() |
boolean |
isEmpty() |
Iterator<T> |
iterator() |
boolean |
remove(Object arg0) |
boolean |
removeAll(Collection<?> arg0) |
boolean |
retainAll(Collection<?> arg0) |
int |
size() |
Object[] |
toArray() |
<U> U[] |
toArray(U[] a) |
static <T> Iterator2List<T> |
toList(Iterator<? extends T> i)
Returns a
List containing all elements in i, preserving duplicates. |
static <T> Iterator2Set<T> |
toSet(Iterator<? extends T> i)
Returns a
Set containing all elements in i. |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitparallelStream, removeIf, spliterator, streamprotected abstract Collection<T> getDelegate()
public static <T> Iterator2Set<T> toSet(Iterator<? extends T> i) throws IllegalArgumentException
Set containing all elements in i. Note that duplicates will be removed.IllegalArgumentExceptionpublic static <T> Iterator2List<T> toList(Iterator<? extends T> i) throws IllegalArgumentException
List containing all elements in i, preserving duplicates.IllegalArgumentExceptionpublic int size()
size in interface Collection<T>public void clear()
clear in interface Collection<T>public boolean isEmpty()
isEmpty in interface Collection<T>public Object[] toArray()
toArray in interface Collection<T>public boolean add(T arg0)
add in interface Collection<T>public boolean contains(Object arg0)
contains in interface Collection<T>public boolean remove(Object arg0)
remove in interface Collection<T>public boolean addAll(Collection<? extends T> arg0)
addAll in interface Collection<T>public boolean containsAll(Collection<?> arg0)
containsAll in interface Collection<T>public boolean removeAll(Collection<?> arg0)
removeAll in interface Collection<T>public boolean retainAll(Collection<?> arg0)
retainAll in interface Collection<T>public <U> U[] toArray(U[] a)
toArray in interface Collection<T>public boolean equals(Object o)
equals in interface Collection<T>equals in class Objectpublic int hashCode()
hashCode in interface Collection<T>hashCode in class Object