public class IlvCollections extends Object
IlvCollections
is a utility class that consists exclusively of
static methods and variables that are of general use when dealing with
collections.Modifier and Type | Method and Description |
---|---|
static ConcurrentModificationException |
concurrentModificationException(String message,
Throwable cause)
Returns a concurrent modification exception that has a cause.
|
static <E> Iterator<E> |
emptyIterator()
Returns an iterator that is always empty.
|
static <E> ListIterator<E> |
emptyListIterator()
Returns a list iterator that is always empty.
|
static <T> IlvUnaryPredicate<T> |
falseUnaryPredicate()
Returns a unary predicate that always evaluates to
false . |
static <E> Iterator<E> |
oneElementIterator(E element)
Returns an unmodifiable iterator that iterates only over the
input element.
|
static <E> ListIterator<E> |
oneElementListIterator(E element)
Returns an unmodifiable iterator that iterates only over the
input element.
|
static <E> ListIterator<E> |
reversedIterator(List<E> list)
Returns an iterator that traverses the specified list in reversed order.
|
static <E> ListIterator<E> |
reversedIterator(ListIterator<E> ite)
Returns an iterator with a reversed order of traversal.
|
static <T> T[] |
toArray(Iterator<T> iter,
Class<T> elementType,
boolean copy)
Returns an array that contains the elements produced by the given
iterator, in order.
|
static <T> IlvUnaryPredicate<T> |
trueUnaryPredicate()
Returns a unary predicate that always evaluates to
true . |
static <E> Iterator<E> |
unmodifiableIterator(Iterator<E> ite)
Returns an unmodifiable version of the specified iterator.
|
static <E> ListIterator<E> |
unmodifiableIterator(ListIterator<E> ite)
Returns an unmodifiable version of the specified iterator.
|
public static <E> Iterator<E> unmodifiableIterator(Iterator<E> ite)
ite
- The original iterator.remove
method is called
on the returned iterator, an UnsupportedOperationException
is thrown.public static <E> ListIterator<E> unmodifiableIterator(ListIterator<E> ite)
ite
- The original iterator.remove
method is called
on the returned iterator, an UnsupportedOperationException
is thrown.public static <E> ListIterator<E> reversedIterator(ListIterator<E> ite)
ite
- The original iterator.public static <E> ListIterator<E> reversedIterator(List<E> list)
list
- The considered list.next()
returns the last element of the list.public static <E> Iterator<E> emptyIterator()
public static <E> ListIterator<E> emptyListIterator()
public static <E> Iterator<E> oneElementIterator(E element)
element
- The element that occurs in the iterator.remove
method is called
on the returned iterator, an UnsupportedOperationException
is thrown.public static <E> ListIterator<E> oneElementListIterator(E element)
element
- The element that occurs in the iterator.remove
, set
or
add
method is called on the returned iterator, an
UnsupportedOperationException
is thrown.public static <T> T[] toArray(Iterator<T> iter, Class<T> elementType, boolean copy)
iter
- An iterator. It is moved to its end by this method.elementType
- The element type of the resulting array, if freshly
allocated.copy
- If true
, the resulting array will always be
freshly allocated. If false
, the resulting array
may be shared with the data structure over which
iter
iterates.iter
produces.
If copy
is false, it should not be written to.public static <T> IlvUnaryPredicate<T> trueUnaryPredicate()
true
.public static <T> IlvUnaryPredicate<T> falseUnaryPredicate()
false
.public static ConcurrentModificationException concurrentModificationException(String message, Throwable cause)
message
- The message of the exception.cause
- The cause, or null
.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.