org.rutil.collection
Class CollectionsHelper
java.lang.Object
org.rutil.collection.CollectionsHelper
public final class CollectionsHelper
- extends java.lang.Object
A helper class with utility methods to deal with some common collection
operations.
- Author:
- mohan
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EMPTY_ITERATOR
public static final java.util.Iterator EMPTY_ITERATOR
EMPTY_LIST
public static final SingleLinkedList EMPTY_LIST
CollectionsHelper
public CollectionsHelper()
emptyIterator
public static <E> java.util.Iterator<E> emptyIterator()
- An iterator with "hasNext" always returning false, next and remove throwing an exception
- Returns:
- returns an empty iterator .
unmodifiableIterator
public static <E> java.util.Iterator<E> unmodifiableIterator(java.util.Iterator<E> iterator)
- A new iterator with wraps the iterator parameter but disallows remove operation.
- Parameters:
iterator -
- Returns:
- new read-only iterator
emptyList
public static <E> SingleLinkedList<E> emptyList()
- Returns:
- empty, unmodifiable single linked list
addAll
public static <T> SingleLinkedList<T> addAll(SingleLinkedList<T> srcList,
SingleLinkedList<T> dstList)
- Parameters:
srcList - source listdstList - destination list or null
- Returns:
- a list that contains all the elements from dstList and srcList.
addAll
public static <T> SingleLinkedList<T> addAll(java.util.Iterator<T> srcList,
SingleLinkedList<T> dstList)
- Parameters:
srcList - source listdstList - destination list or null
- Returns:
- a list that contains all the elements from dstList and srcList.