Skip navigation links

Oracle® Coherence Java API Reference
Release 3.6.0.0

E15725-01


com.tangosol.util
Class ConverterCollections.ConverterCollection

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.util.ConverterCollections.ConverterCollection

All Implemented Interfaces:
Serializable, Iterable, Collection
Direct Known Subclasses:
ConverterCollections.ConverterList, ConverterCollections.ConverterSet
Enclosing class:
ConverterCollections

public static class ConverterCollections.ConverterCollection
extends Base
implements Collection, Serializable

A Converter Collection views an underlying Collection through a Converter.


Field Summary
protected  Collection m_col
          The underlying Collection.
protected  Converter m_convDown
          The Converter from this Collection to the underlying Collection.
protected  Converter m_convUp
          The Converter from the underlying Collection to this Collection.

 

Constructor Summary
ConverterCollections.ConverterCollection(Collection col, Converter convUp, Converter convDown)
          Constructor.

 

Method Summary
 boolean add(Object o)
          Ensures that this Collection contains the specified element.
 boolean addAll(Collection col)
          Adds all of the elements in the specified Collection to this Collection (optional operation).
 void clear()
          Removes all of the elements from this Collection.
 boolean contains(Object o)
          Returns true if this Collection contains the specified element.
 boolean containsAll(Collection col)
          Returns true if this Collection contains all of the elements in the specified Collection.
 boolean equals(Object o)
          Compares the specified object with this collection for equality.
 Collection getCollection()
          Return the underlying Collection.
 Converter getConverterDown()
          Return the Converter used to pass values down to the underlying Collection.
 Converter getConverterUp()
          Return the Converter used to view the underlying Collection's values through.
protected  Collection instantiateCollection(Collection col, Converter convUp, Converter convDown)
          Create a Converter Collection.
protected  Iterator instantiateIterator(Iterator iter, Converter conv)
          Create a Converter Iterator.
 void invalidate()
          Drop references to the underlying Collection and the Converters.
 boolean isEmpty()
          Returns true if this Collection contains no elements.
 Iterator iterator()
          Returns an Iterator over the elements contained in this Collection.
 boolean remove(Object o)
          Removes a single instance of the specified element from this Collection, if it is present (optional operation).
 boolean removeAll(Collection col)
          Removes all this Collection's elements that are also contained in the specified Collection (optional operation).
 boolean retainAll(Collection col)
          Retains only the elements in this Collection that are contained in the specified Collection (optional operation).
 int size()
          Returns the number of elements in this Collection.
 Object[] toArray()
          Returns an array containing all of the elements in this Collection.
 Object[] toArray(Object[] aoDest)
          Returns an array containing all of the elements in this Collection whose runtime type is that of the specified array.
 String toString()
          Return a String description for this collection.

 

Methods inherited from interface java.util.Collection
hashCode

 

Field Detail

m_col

protected Collection m_col
The underlying Collection.

m_convUp

protected Converter m_convUp
The Converter from the underlying Collection to this Collection.

m_convDown

protected Converter m_convDown
The Converter from this Collection to the underlying Collection.

Constructor Detail

ConverterCollections.ConverterCollection

public ConverterCollections.ConverterCollection(Collection col,
                                                Converter convUp,
                                                Converter convDown)
Constructor.
Parameters:
col - the underlying Collection
convUp - the Converter from the underlying Collection
convDown - the Converter to the underlying Collection

Method Detail

size

public int size()
Returns the number of elements in this Collection.
Specified by:
size in interface Collection
Returns:
the number of elements in this Collection

isEmpty

public boolean isEmpty()
Returns true if this Collection contains no elements.
Specified by:
isEmpty in interface Collection
Returns:
true if this Collection contains no elements

contains

public boolean contains(Object o)
Returns true if this Collection contains the specified element. More formally, returns true if and only if this Collection contains at least one element e such that (o==null ? e==null : o.equals(e)).
Specified by:
contains in interface Collection
Parameters:
o - the object to search for in the Collection
Returns:
true if this Collection contains the specified object

iterator

public Iterator iterator()
Returns an Iterator over the elements contained in this Collection.
Specified by:
iterator in interface Iterable
Specified by:
iterator in interface Collection
Returns:
an Iterator over the elements contained in this Collection

toArray

public Object[] toArray()
Returns an array containing all of the elements in this Collection. Obeys the general contract of Collection.toArray.
Specified by:
toArray in interface Collection
Returns:
an array, whose component type is the class of objects that may be stored in the Collection containing all of the elements in this Collection

toArray

public Object[] toArray(Object[] aoDest)
Returns an array containing all of the elements in this Collection whose runtime type is that of the specified array. Obeys the general contract of Collection.toArray.
Specified by:
toArray in interface Collection
Parameters:
aoDest - the array into which the elements of this Collection are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose
Returns:
an array containing the elements of this Collection

add

public boolean add(Object o)
Ensures that this Collection contains the specified element.
Specified by:
add in interface Collection
Parameters:
o - element whose presence in this Collection is to be ensured
Returns:
true if the Collection changed as a result of the call

remove

public boolean remove(Object o)
Removes a single instance of the specified element from this Collection, if it is present (optional operation). More formally, removes an element e such that (o==null ? e==null : o.equals(e)), if the Collection contains one or more such elements. Returns true if the Collection contained the specified element (or equivalently, if the Collection changed as a result of the call).
Specified by:
remove in interface Collection
Parameters:
o - element to be removed from this Collection, if present
Returns:
true if the Collection contained the specified element

containsAll

public boolean containsAll(Collection col)
Returns true if this Collection contains all of the elements in the specified Collection.
Specified by:
containsAll in interface Collection
Parameters:
col - Collection to be checked for containment in this Collection
Returns:
true if this Collection contains all of the elements in the specified Collection
See Also:
Collection.contains(Object)

addAll

public boolean addAll(Collection col)
Adds all of the elements in the specified Collection to this Collection (optional operation). The behavior of this operation is undefined if the specified Collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified Collection is this Collection, and this Collection is nonempty.)
Specified by:
addAll in interface Collection
Parameters:
col - elements to be inserted into this Collection
Returns:
true if this Collection changed as a result of the call
See Also:
Collection.add(Object)

removeAll

public boolean removeAll(Collection col)
Removes all this Collection's elements that are also contained in the specified Collection (optional operation). After this call returns, this Collection will contain no elements in common with the specified Collection.
Specified by:
removeAll in interface Collection
Parameters:
col - elements to be removed from this Collection
Returns:
true if this Collection changed as a result of the call
See Also:
Collection.remove(Object), Collection.contains(Object)

retainAll

public boolean retainAll(Collection col)
Retains only the elements in this Collection that are contained in the specified Collection (optional operation). In other words, removes from this Collection all of its elements that are not contained in the specified Collection.
Specified by:
retainAll in interface Collection
Parameters:
col - elements to be retained in this Collection
Returns:
true if this Collection changed as a result of the call
See Also:
Collection.remove(Object), Collection.contains(Object)

clear

public void clear()
Removes all of the elements from this Collection.
Specified by:
clear in interface Collection

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
Parameters:
o - Object to be compared for equality with this Collection
Returns:
true if the specified object is equal to this Collection
See Also:
Object.equals(Object), Set.equals(Object), List.equals(Object)

toString

public String toString()
Return a String description for this collection.
Returns:
a String description of the Collection

invalidate

public void invalidate()
Drop references to the underlying Collection and the Converters.

instantiateCollection

protected Collection instantiateCollection(Collection col,
                                           Converter convUp,
                                           Converter convDown)
Create a Converter 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 instantiateIterator(Iterator iter,
                                       Converter 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 getCollection()
Return the underlying Collection.
Returns:
the underlying Collection

getConverterUp

public Converter getConverterUp()
Return the Converter used to view the underlying Collection's values through.
Returns:
the Converter from the underlying Collection

getConverterDown

public Converter getConverterDown()
Return the Converter used to pass values down to the underlying Collection.
Returns:
the Converter to the underlying Collection

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.6.0.0

E15725-01


Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.