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 Collection
T - 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:
  • Field Details

    • m_col

      protected Collection<F> m_col
      The underlying Collection.
    • m_convUp

      protected Converter<F,T> m_convUp
      The Converter from the underlying Collection to this Collection.
    • m_convDown

      protected Converter<T,F> m_convDown
      The Converter from this Collection to the underlying Collection.
  • Constructor Details

    • ConverterCollection

      public ConverterCollection(Collection<F> col, Converter<F,T> convUp, Converter<T,F> convDown)
      Constructor.
      Parameters:
      col - the underlying Collection
      convUp - the Converter from the underlying Collection
      convDown - the Converter to the underlying Collection
  • Method Details

    • size

      public int size()
      Specified by:
      size in interface Collection<F>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Collection<F>
    • contains

      public boolean contains(Object o)
      Specified by:
      contains in interface Collection<F>
    • iterator

      public Iterator<T> iterator()
      Specified by:
      iterator in interface Collection<F>
      Specified by:
      iterator in interface Iterable<F>
    • toArray

      public Object[] toArray()
      Specified by:
      toArray in interface Collection<F>
    • toArray

      public <E> E[] toArray(E[] aoDest)
      Specified by:
      toArray in interface Collection<F>
    • add

      public boolean add(T o)
      Specified by:
      add in interface Collection<F>
    • remove

      public boolean remove(Object o)
      Specified by:
      remove in interface Collection<F>
    • containsAll

      public boolean containsAll(Collection<?> col)
      Specified by:
      containsAll in interface Collection<F>
    • addAll

      public boolean addAll(Collection<? extends T> col)
      Specified by:
      addAll in interface Collection<F>
    • removeAll

      public boolean removeAll(Collection<?> col)
      Specified by:
      removeAll in interface Collection<F>
    • retainAll

      public boolean retainAll(Collection<?> col)
      Specified by:
      retainAll in interface Collection<F>
    • clear

      public void clear()
      Specified by:
      clear in interface Collection<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 interface Collection<F>
      Overrides:
      equals in class Object
      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.
      Overrides:
      toString in class Object
      Returns:
      a String description of the 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:
      T - the type that the elements should be converted to
      F - the type of elements in the underlying Collection
      Parameters:
      col - the underlying Collection
      convUp - the Converter to view the underlying Collection through
      convDown - 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 Iterator
      conv - 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
    • getConverterDown

      public Converter<T,F> getConverterDown()
      Return the Converter used to pass values down to the underlying Collection.
      Returns:
      the Converter to the underlying Collection