@Immutable public final class DuplicateOnWriteSimpleCollection<E> extends Object implements SimpleCollection<E>
Modifier and Type | Method and Description |
---|---|
DuplicateOnWriteSimpleCollection<E> |
add(E element)
Add a new element to a new collection
|
static <E> DuplicateOnWriteSimpleCollection<E> |
create()
Create an empty collection.
|
static <E> DuplicateOnWriteSimpleCollection<E> |
create(E[] array)
Create a collection from an array.
|
boolean |
isEmpty() |
Iterator<E> |
iterator()
Returns an iterator over the elements in this collection.
|
DuplicateOnWriteSimpleCollection<E> |
remove(E element)
Remove an element from a new collection
|
DuplicateOnWriteSimpleCollection<E> |
replace(E newElement,
E oldElement)
Replace an element in a new collection.
|
int |
size()
Returns an estimate of the number of elements in the collection.
|
Iterator<E> |
structuralIterator()
An iterator over the structure of the collection.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
stream
forEach, spliterator
public int size()
SimpleCollection
size
in interface SimpleCollection<E>
public boolean isEmpty()
isEmpty
in interface SimpleCollection<E>
true
if there are no childrenpublic Iterator<E> iterator()
SimpleCollection
public Iterator<E> structuralIterator()
SimpleCollection
structuralIterator
in interface SimpleCollection<E>
public DuplicateOnWriteSimpleCollection<E> add(E element)
element
- the element to addpublic DuplicateOnWriteSimpleCollection<E> remove(E element)
element
- the element to removepublic DuplicateOnWriteSimpleCollection<E> replace(E newElement, E oldElement)
newElement
- the element to addoldElement
- the element to removepublic static <E> DuplicateOnWriteSimpleCollection<E> create()
E
- The type of elements in the collectionpublic static <E> DuplicateOnWriteSimpleCollection<E> create(E[] array)
E
- The type of elements in the collectionarray
- The arrayCopyright © 2014–2016. All rights reserved.