E
- the type of elements in this collectionpublic final class UnmodifiableCollection<E> extends Object implements Collection<E>, Serializable
Collection
. Unlike the view returned via
Collections.unmodifiableCollection(Collection)
, this class checks its
argument to ensure multiple encapsulation does not occur.
This class checks
the argument so it prevents multiple encapsulation. Subclasses of
ImmutableCollection
are also recognized and not encapsulated.
Modifier and Type | Method and Description |
---|---|
boolean |
add(E e) |
boolean |
addAll(Collection<? extends E> c) |
void |
clear() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
static <T> Collection<T> |
create(Collection<T> collection)
Create an unmodifiable view of the target collection.
|
boolean |
isEmpty() |
Iterator<E> |
iterator() |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(Collection<?> c) |
int |
size() |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
equals, hashCode, parallelStream, removeIf, spliterator, stream
public static <T> Collection<T> create(@Nonnull Collection<T> collection)
collection
- Target collectionpublic int size()
size
in interface Collection<E>
public boolean isEmpty()
isEmpty
in interface Collection<E>
public boolean contains(Object o)
contains
in interface Collection<E>
public Object[] toArray()
toArray
in interface Collection<E>
public <T> T[] toArray(@Nonnull T[] a)
toArray
in interface Collection<E>
public boolean containsAll(@Nonnull Collection<?> c)
containsAll
in interface Collection<E>
public boolean add(E e)
add
in interface Collection<E>
public boolean addAll(@Nonnull Collection<? extends E> c)
addAll
in interface Collection<E>
public boolean remove(Object o)
remove
in interface Collection<E>
public boolean removeAll(@Nonnull Collection<?> c)
removeAll
in interface Collection<E>
public boolean retainAll(@Nonnull Collection<?> c)
retainAll
in interface Collection<E>
public void clear()
clear
in interface Collection<E>
Copyright © 2018 OpenDaylight. All rights reserved.