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> @NonNull Collection<T> |
create(@NonNull Collection<T> collection)
Create an unmodifiable view of the target collection.
|
boolean |
isEmpty() |
@NonNull Iterator<E> |
iterator() |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(Collection<?> c) |
int |
size() |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
@NonNull String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
equals, hashCode, parallelStream, removeIf, spliterator, stream
public static <T> @NonNull Collection<T> create(@NonNull Collection<T> collection)
collection
- Target collectionNullPointerException
- if collection
is nullpublic 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(T[] a)
toArray
in interface Collection<E>
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<E>
public boolean add(E e)
add
in interface Collection<E>
public boolean addAll(Collection<? extends E> c)
addAll
in interface Collection<E>
public boolean remove(Object o)
remove
in interface Collection<E>
public boolean removeAll(Collection<?> c)
removeAll
in interface Collection<E>
public boolean retainAll(Collection<?> c)
retainAll
in interface Collection<E>
public void clear()
clear
in interface Collection<E>
Copyright © 2019 OpenDaylight. All rights reserved.