T
- List typepublic final class CollectionOf<T> extends Object implements Collection<T>
Collection
.
This class should be used very carefully. You must understand that
it will fetch the entire content of the encapsulated Iterable
on each
method call. It doesn't cache the data anyhow.
If you don't need this Collection
to re-fresh
its content on every call, by doing round-trips to
the encapsulated iterable, use Sticky
.
There is no thread-safety guarantee.
Sticky
Constructor and Description |
---|
CollectionOf(Iterable<T> src)
Ctor.
|
CollectionOf(Scalar<Collection<T>> slr)
Ctor.
|
CollectionOf(T... array)
Ctor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(T elem) |
boolean |
addAll(Collection<? extends T> other) |
void |
clear() |
boolean |
contains(Object obj) |
boolean |
containsAll(Collection<?> other) |
boolean |
equals(Object other) |
int |
hashCode() |
boolean |
isEmpty() |
Iterator<T> |
iterator() |
boolean |
remove(Object obj) |
boolean |
removeAll(Collection<?> other) |
boolean |
retainAll(Collection<?> other) |
int |
size() |
Object[] |
toArray() |
<X> X[] |
toArray(X[] array) |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
parallelStream, removeIf, spliterator, stream
@SafeVarargs public CollectionOf(T... array)
array
- An array of some elementspublic CollectionOf(Scalar<Collection<T>> slr)
slr
- The scalarpublic int size()
size
in interface Collection<T>
public boolean isEmpty()
isEmpty
in interface Collection<T>
public boolean contains(Object obj)
contains
in interface Collection<T>
public Object[] toArray()
toArray
in interface Collection<T>
public <X> X[] toArray(X[] array)
toArray
in interface Collection<T>
public boolean add(T elem)
add
in interface Collection<T>
public boolean remove(Object obj)
remove
in interface Collection<T>
public boolean containsAll(Collection<?> other)
containsAll
in interface Collection<T>
public boolean addAll(Collection<? extends T> other)
addAll
in interface Collection<T>
public boolean removeAll(Collection<?> other)
removeAll
in interface Collection<T>
public boolean retainAll(Collection<?> other)
retainAll
in interface Collection<T>
public void clear()
clear
in interface Collection<T>
public boolean equals(Object other)
equals
in interface Collection<T>
equals
in class Object
public int hashCode()
hashCode
in interface Collection<T>
hashCode
in class Object
Copyright © 2017–2019 Cactoos. All rights reserved.