|
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(java.util.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,
java.util.Collection<? extends E> arg1)
Operation is not supported. |
E |
get(int index)
|
int |
indexOf(java.lang.Object o)
|
int |
lastIndexOf(java.lang.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. |
java.util.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(java.util.List<E> l)
Method Detail |
---|
public E get(int index)
get
in interface java.util.List<E>
public int indexOf(java.lang.Object o)
indexOf
in interface java.util.List<E>
public int lastIndexOf(java.lang.Object o)
lastIndexOf
in interface java.util.List<E>
public UnmodifiableListIterator<E> listIterator()
listIterator
in interface java.util.List<E>
public UnmodifiableListIterator<E> listIterator(int index)
listIterator
in interface java.util.List<E>
public java.util.List<E> subList(int fromIndex, int toIndex)
subList
in interface java.util.List<E>
public void add(int arg0, E arg1)
add
in interface java.util.List<E>
java.lang.UnsupportedOperationException
public boolean addAll(int arg0, java.util.Collection<? extends E> arg1)
addAll
in interface java.util.List<E>
java.lang.UnsupportedOperationException
public E remove(int arg0)
remove
in interface java.util.List<E>
java.lang.UnsupportedOperationException
public E set(int arg0, E arg1)
set
in interface java.util.List<E>
java.lang.UnsupportedOperationException
|
TUM CCSM Commons | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |