Class Iterator2Collection<T>
java.lang.Object
com.ibm.wala.util.collections.Iterator2Collection<T>
- All Implemented Interfaces:
Iterable<T>, Collection<T>
- Direct Known Subclasses:
Iterator2List, Iterator2Set
Converts an
Iterator to a Collection. Note that if you just want to use Java 5's
for-each loop with an Iterator, use Iterator2Iterable.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanaddAll(Collection<? extends T> arg0) voidclear()booleanbooleancontainsAll(Collection<?> arg0) booleanprotected abstract Collection<T> inthashCode()booleanisEmpty()iterator()booleanbooleanremoveAll(Collection<?> arg0) booleanretainAll(Collection<?> arg0) intsize()Object[]toArray()<U> U[]toArray(U[] a) static <T> Iterator2List<T> Returns aListcontaining all elements in i, preserving duplicates.static <T> Iterator2Set<T> Returns aSetcontaining all elements in i.toString()Methods inherited from interface Collection
parallelStream, removeIf, spliterator, stream, toArray
-
Constructor Details
-
Iterator2Collection
public Iterator2Collection()
-
-
Method Details
-
getDelegate
-
toSet
Returns aSetcontaining all elements in i. Note that duplicates will be removed.- Throws:
IllegalArgumentException
-
toList
Returns aListcontaining all elements in i, preserving duplicates.- Throws:
IllegalArgumentException
-
toString
-
size
public int size()- Specified by:
sizein interfaceCollection<T>
-
clear
public void clear()- Specified by:
clearin interfaceCollection<T>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<T>
-
toArray
- Specified by:
toArrayin interfaceCollection<T>
-
add
- Specified by:
addin interfaceCollection<T>
-
contains
- Specified by:
containsin interfaceCollection<T>
-
remove
- Specified by:
removein interfaceCollection<T>
-
addAll
- Specified by:
addAllin interfaceCollection<T>
-
containsAll
- Specified by:
containsAllin interfaceCollection<T>
-
removeAll
- Specified by:
removeAllin interfaceCollection<T>
-
retainAll
- Specified by:
retainAllin interfaceCollection<T>
-
iterator
-
toArray
public <U> U[] toArray(U[] a) - Specified by:
toArrayin interfaceCollection<T>
-
equals
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection<T>- Overrides:
hashCodein classObject
-