|
TUM CCSM Commons | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.tum.cs.commons.collections.UnmodifiableCollection<E>
edu.tum.cs.commons.collections.UnmodifiableList<E>
public class UnmodifiableList<E>
This is a wrapper for a List prohibiting all calls which would modify
its contents. As the construction of this class is performed in constant time
it is prefered over copying the list (which takes linear time). Using this
class is also preferred to using the unmodifiableX() in class
Collections as they return the collection base type that does not
signal, that the object ist unmodifiable. Using the classes in this package
makes unmodifiability more explicit.
All prohibited methods throw an UnsupportedOperationException. The
class is nearly the same as the one returned by
Collections.unmodifiableList(List), but by making it a public class
we can make the return value of some methods more explicit.
This list is serializable if the wrapped list is serializable.
| Constructor Summary | |
|---|---|
UnmodifiableList(List<E> l)
Creates a new unmodifiable list from another list. |
|
| Method Summary | |
|---|---|
void |
add(int arg0,
E arg1)
Operation is not supported. |
boolean |
addAll(int arg0,
Collection<? extends E> arg1)
Operation is not supported. |
E |
get(int index)
|
int |
indexOf(Object o)
|
int |
lastIndexOf(Object o)
|
UnmodifiableListIterator<E> |
listIterator()
|
UnmodifiableListIterator<E> |
listIterator(int index)
|
E |
remove(int arg0)
Operation is not supported. |
E |
set(int arg0,
E arg1)
Operation is not supported. |
List<E> |
subList(int fromIndex,
int toIndex)
|
| Methods inherited from class edu.tum.cs.commons.collections.UnmodifiableCollection |
|---|
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.List |
|---|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
| Constructor Detail |
|---|
public UnmodifiableList(List<E> l)
| Method Detail |
|---|
public E get(int index)
get in interface List<E>public int indexOf(Object o)
indexOf in interface List<E>public int lastIndexOf(Object o)
lastIndexOf in interface List<E>public UnmodifiableListIterator<E> listIterator()
listIterator in interface List<E>public UnmodifiableListIterator<E> listIterator(int index)
listIterator in interface List<E>
public List<E> subList(int fromIndex,
int toIndex)
subList in interface List<E>
public void add(int arg0,
E arg1)
add in interface List<E>UnsupportedOperationException
public boolean addAll(int arg0,
Collection<? extends E> arg1)
addAll in interface List<E>UnsupportedOperationExceptionpublic E remove(int arg0)
remove in interface List<E>UnsupportedOperationException
public E set(int arg0,
E arg1)
set in interface List<E>UnsupportedOperationException
|
TUM CCSM Commons | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||