java.util
static class: Collections.SingletonList [javadoc |
source]
java.lang.Object
java.util.AbstractCollection
java.util.AbstractList
java.util.Collections$SingletonList
All Implemented Interfaces:
Serializable, RandomAccess, List, Collection
| Methods from java.util.AbstractList: |
|---|
|
add, add, addAll, clear, equals, get, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList |
| Methods from java.util.AbstractCollection: |
|---|
|
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray, toString |
| Methods from java.lang.Object: |
|---|
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from java.util.Collections$SingletonList Detail: |
public boolean contains(Object obj) {
return eq(obj, element);
}
|
public E get(int index) {
if (index != 0)
throw new IndexOutOfBoundsException("Index: "+index+", Size: 1");
return element;
}
|
public Iterator iterator() {
return singletonIterator(element);
}
|
public int size() {
return 1;
}
|