Package com.tangosol.util
Class ConverterCollections.ConverterCollection<F,T>
- java.lang.Object
-
- com.tangosol.util.ConverterCollections.ConverterCollection<F,T>
-
- Type Parameters:
F
- the type of elements in the underlying CollectionT
- the type that the elements should be converted to
- All Implemented Interfaces:
Serializable
,Iterable<T>
,Collection<T>
- Direct Known Subclasses:
ConverterCollections.ConverterList
,ConverterCollections.ConverterSet
- Enclosing class:
- ConverterCollections
public static class ConverterCollections.ConverterCollection<F,T> extends Object implements Collection<T>, Serializable
A Converter Collection views an underlying Collection through a Converter.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Collection<F>
m_col
The underlying Collection.protected Converter<T,F>
m_convDown
The Converter from this Collection to the underlying Collection.protected Converter<F,T>
m_convUp
The Converter from the underlying Collection to this Collection.
-
Constructor Summary
Constructors Constructor Description ConverterCollection(Collection<F> col, Converter<F,T> convUp, Converter<T,F> convDown)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(T o)
boolean
addAll(Collection<? extends T> col)
void
clear()
boolean
contains(Object o)
boolean
containsAll(Collection<?> col)
boolean
equals(Object o)
Compares the specified object with this collection for equality.Collection<F>
getCollection()
Return the underlying Collection.Converter<T,F>
getConverterDown()
Return the Converter used to pass values down to the underlying Collection.Converter<F,T>
getConverterUp()
Return the Converter used to view the underlying Collection's values through.protected <T,F>
Collection<T>instantiateCollection(Collection<F> col, Converter<F,T> convUp, Converter<T,F> convDown)
Create a Converter Collection.protected Iterator<T>
instantiateIterator(Iterator<F> iter, Converter<F,T> conv)
Create a Converter Iterator.void
invalidate()
Drop references to the underlying Collection and the Converters.boolean
isEmpty()
Iterator<T>
iterator()
boolean
remove(Object o)
boolean
removeAll(Collection<?> col)
boolean
retainAll(Collection<?> col)
int
size()
Object[]
toArray()
<E> E[]
toArray(E[] aoDest)
String
toString()
Return a String description for this collection.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
hashCode, parallelStream, removeIf, spliterator, stream, toArray
-
-
-
-
Method Detail
-
size
public int size()
- Specified by:
size
in interfaceCollection<F>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceCollection<F>
-
contains
public boolean contains(Object o)
- Specified by:
contains
in interfaceCollection<F>
-
toArray
public Object[] toArray()
- Specified by:
toArray
in interfaceCollection<F>
-
toArray
public <E> E[] toArray(E[] aoDest)
- Specified by:
toArray
in interfaceCollection<F>
-
add
public boolean add(T o)
- Specified by:
add
in interfaceCollection<F>
-
remove
public boolean remove(Object o)
- Specified by:
remove
in interfaceCollection<F>
-
containsAll
public boolean containsAll(Collection<?> col)
- Specified by:
containsAll
in interfaceCollection<F>
-
addAll
public boolean addAll(Collection<? extends T> col)
- Specified by:
addAll
in interfaceCollection<F>
-
removeAll
public boolean removeAll(Collection<?> col)
- Specified by:
removeAll
in interfaceCollection<F>
-
retainAll
public boolean retainAll(Collection<?> col)
- Specified by:
retainAll
in interfaceCollection<F>
-
clear
public void clear()
- Specified by:
clear
in interfaceCollection<F>
-
equals
public boolean equals(Object o)
Compares the specified object with this collection for equality.Obeys the general contract of Collection.equals.
- Specified by:
equals
in interfaceCollection<F>
- Overrides:
equals
in classObject
- Parameters:
o
- Object to be compared for equality with this Collection- Returns:
- true if the specified object is equal to this Collection
-
toString
public String toString()
Return a String description for this collection.
-
invalidate
public void invalidate()
Drop references to the underlying Collection and the Converters.
-
instantiateCollection
protected <T,F> Collection<T> instantiateCollection(Collection<F> col, Converter<F,T> convUp, Converter<T,F> convDown)
Create a Converter Collection.- Type Parameters:
F
- the type of elements in the underlying CollectionT
- the type that the elements should be converted to- Parameters:
col
- the underlying CollectionconvUp
- the Converter to view the underlying Collection throughconvDown
- the Converter to pass items down to the underlying Collection through- Returns:
- a Converter Collection
-
instantiateIterator
protected Iterator<T> instantiateIterator(Iterator<F> iter, Converter<F,T> conv)
Create a Converter Iterator.- Parameters:
iter
- the underlying Iteratorconv
- the Converter to view the underlying Iterator through- Returns:
- a Converter Iterator
-
getCollection
public Collection<F> getCollection()
Return the underlying Collection.- Returns:
- the underlying Collection
-
getConverterUp
public Converter<F,T> getConverterUp()
Return the Converter used to view the underlying Collection's values through.- Returns:
- the Converter from the underlying Collection
-
-