T - original typeU - mapped typepublic class ZMappedCollection<T,U> extends java.lang.Object implements ZCollection<U>
| Constructor and Description |
|---|
ZMappedCollection(java.lang.Class<U> type,
ZCollection<T> original,
Function<T,U> function)
Constructs an unidirectionally mapped collection.
|
ZMappedCollection(java.lang.Class<U> type,
ZCollection<T> original,
Function<T,U> function,
Function<U,T> backwardsFunction)
Constructs a bidirectionally mapped collection.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(U e)
Adds an element to the collection.
|
boolean |
addAll(java.lang.Iterable<? extends U> c)
Adds all the objects from the given collection to this collection.
|
void |
clear()
Removes all elements from this collection.
|
boolean |
contains(U o)
Checks if the collection contains the given element.
|
java.lang.Class<U> |
getElementClass()
Returns the collection's element class.
|
boolean |
isEmpty()
Checks if this collection is empty.
|
java.util.Iterator<U> |
iterator() |
boolean |
remove(U o)
Removes an element from the collection.
|
boolean |
removeAll(java.lang.Iterable<? extends U> c)
Removes all the objects from the given collection from this collection.
|
int |
size()
Returns the size of this collection.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic ZMappedCollection(java.lang.Class<U> type, ZCollection<T> original, Function<T,U> function)
type - element typeoriginal - original collectionfunction - mapping functionpublic ZMappedCollection(java.lang.Class<U> type, ZCollection<T> original, Function<T,U> function, Function<U,T> backwardsFunction)
type - element typeoriginal - original collectionfunction - mapping function (from original to new type)backwardsFunction - backwards function (from new type to original)public java.lang.Class<U> getElementClass()
ZCollectiongetElementClass in interface ZCollection<U>public int size()
ZCollectionsize in interface ZCollection<U>public boolean isEmpty()
ZCollectionisEmpty in interface ZCollection<U>public java.util.Iterator<U> iterator()
iterator in interface java.lang.Iterable<U>public boolean add(U e)
ZCollectionadd in interface ZCollection<U>e - value to be addedpublic boolean remove(U o)
ZCollectionremove in interface ZCollection<U>o - value to be removedpublic boolean contains(U o)
ZCollectioncontains in interface ZCollection<U>o - value to check the collection forpublic boolean addAll(java.lang.Iterable<? extends U> c)
ZCollectionaddAll in interface ZCollection<U>c - collection of elements to addpublic boolean removeAll(java.lang.Iterable<? extends U> c)
ZCollectionremoveAll in interface ZCollection<U>c - collection of elements to removepublic void clear()
ZCollectionclear in interface ZCollection<U>