|
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(java.util.Collection<E> c)
Creates a new unmodifiable collection from another collection. |
Method Summary | ||
---|---|---|
boolean |
add(E arg0)
Operation is not supported. |
|
boolean |
addAll(java.util.Collection<? extends E> arg0)
Operation is not supported. |
|
void |
clear()
Operation is not supported. |
|
boolean |
contains(java.lang.Object o)
|
|
boolean |
containsAll(java.util.Collection<?> other)
|
|
boolean |
isEmpty()
|
|
UnmodifiableIterator<E> |
iterator()
|
|
boolean |
remove(java.lang.Object arg0)
Operation is not supported. |
|
boolean |
removeAll(java.util.Collection<?> arg0)
Operation is not supported. |
|
boolean |
retainAll(java.util.Collection<?> arg0)
Operation is not supported. |
|
int |
size()
|
|
java.lang.Object[] |
toArray()
|
|
|
toArray(T[] a)
|
|
java.lang.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(java.util.Collection<E> c)
Method Detail |
---|
public boolean isEmpty()
isEmpty
in interface java.util.Collection<E>
public int size()
size
in interface java.util.Collection<E>
public boolean contains(java.lang.Object o)
contains
in interface java.util.Collection<E>
public boolean containsAll(java.util.Collection<?> other)
containsAll
in interface java.util.Collection<E>
public UnmodifiableIterator<E> iterator()
iterator
in interface java.lang.Iterable<E>
iterator
in interface java.util.Collection<E>
public java.lang.Object[] toArray()
toArray
in interface java.util.Collection<E>
public <T> T[] toArray(T[] a)
toArray
in interface java.util.Collection<E>
public boolean add(E arg0)
add
in interface java.util.Collection<E>
java.lang.UnsupportedOperationException
public boolean addAll(java.util.Collection<? extends E> arg0)
addAll
in interface java.util.Collection<E>
java.lang.UnsupportedOperationException
public void clear()
clear
in interface java.util.Collection<E>
java.lang.UnsupportedOperationException
public boolean remove(java.lang.Object arg0)
remove
in interface java.util.Collection<E>
java.lang.UnsupportedOperationException
public boolean removeAll(java.util.Collection<?> arg0)
removeAll
in interface java.util.Collection<E>
java.lang.UnsupportedOperationException
public boolean retainAll(java.util.Collection<?> arg0)
retainAll
in interface java.util.Collection<E>
java.lang.UnsupportedOperationException
public java.lang.String toString()
toString
in class java.lang.Object
|
TUM CCSM Commons | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |