|
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>
public class UnmodifiableCollection<E>
This is a wrapper for a Collection prohibiting all calls which would
modify its contents. As the construction of this class is performed in
constant time it is preferred over copying the collection (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 is
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.unmodifiableCollection(Collection), but by making it a
public class we can make the return value of some methods more explicit.
This collection is serializable if the wrapped collection is serializable.
| Constructor Summary | |
|---|---|
UnmodifiableCollection(Collection<E> c)
Creates a new unmodifiable collection from another collection. |
|
| Method Summary | ||
|---|---|---|
boolean |
add(E arg0)
Operation is not supported. |
|
boolean |
addAll(Collection<? extends E> arg0)
Operation is not supported. |
|
void |
clear()
Operation is not supported. |
|
boolean |
contains(Object o)
|
|
boolean |
containsAll(Collection<?> other)
|
|
boolean |
isEmpty()
|
|
UnmodifiableIterator<E> |
iterator()
|
|
boolean |
remove(Object arg0)
Operation is not supported. |
|
boolean |
removeAll(Collection<?> arg0)
Operation is not supported. |
|
boolean |
retainAll(Collection<?> arg0)
Operation is not supported. |
|
int |
size()
|
|
Object[] |
toArray()
|
|
|
toArray(T[] a)
|
|
String |
toString()
Returns a string representation of this collection. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Collection |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public UnmodifiableCollection(Collection<E> c)
| Method Detail |
|---|
public boolean isEmpty()
isEmpty in interface Collection<E>public int size()
size in interface Collection<E>public boolean contains(Object o)
contains in interface Collection<E>public boolean containsAll(Collection<?> other)
containsAll in interface Collection<E>public UnmodifiableIterator<E> iterator()
iterator in interface Iterable<E>iterator in interface Collection<E>public Object[] toArray()
toArray in interface Collection<E>public <T> T[] toArray(T[] a)
toArray in interface Collection<E>public boolean add(E arg0)
add in interface Collection<E>UnsupportedOperationExceptionpublic boolean addAll(Collection<? extends E> arg0)
addAll in interface Collection<E>UnsupportedOperationExceptionpublic void clear()
clear in interface Collection<E>UnsupportedOperationExceptionpublic boolean remove(Object arg0)
remove in interface Collection<E>UnsupportedOperationExceptionpublic boolean removeAll(Collection<?> arg0)
removeAll in interface Collection<E>UnsupportedOperationExceptionpublic boolean retainAll(Collection<?> arg0)
retainAll in interface Collection<E>UnsupportedOperationExceptionpublic String toString()
toString in class Object
|
TUM CCSM Commons | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||