Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.0.0

E18683-01


com.tangosol.util
Class ImmutableArrayList.SortedSetView

java.lang.Object
  extended by com.tangosol.util.WrapperCollections.AbstractWrapperCollection
      extended by com.tangosol.util.WrapperCollections.AbstractWrapperSet
          extended by com.tangosol.util.WrapperCollections.AbstractWrapperSortedSet
              extended by com.tangosol.util.ImmutableArrayList.SortedSetView

All Implemented Interfaces:
java.lang.Iterable, java.util.Collection, java.util.Set, java.util.SortedSet
Enclosing class:
ImmutableArrayList

protected class ImmutableArrayList.SortedSetView
extends WrapperCollections.AbstractWrapperSortedSet

SetView exposes the underlying ImmutableArrayList through the SortedSet interface, maintaining correct equals() and hashCode() semantics


Field Summary

 

Fields inherited from class com.tangosol.util.WrapperCollections.AbstractWrapperSortedSet
m_setDelegate

 

Fields inherited from class com.tangosol.util.WrapperCollections.AbstractWrapperCollection
m_colDelegate

 

Constructor Summary
protected ImmutableArrayList.SortedSetView()
          Create a SortedSetView over this ImmutableArrayList.

 

Method Summary
 boolean equals(java.lang.Object o)
          Compares the specified object with this collection for equality.
 int hashCode()
          Returns the hash code value for this collection.
 java.lang.String toString()
          

 

Methods inherited from class com.tangosol.util.WrapperCollections.AbstractWrapperSortedSet
comparator, first, getDelegate, headSet, last, subSet, tailSet

 

Methods inherited from class com.tangosol.util.WrapperCollections.AbstractWrapperCollection
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray

 

Methods inherited from interface java.util.Set
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray

 

Constructor Detail

ImmutableArrayList.SortedSetView

protected ImmutableArrayList.SortedSetView()
Create a SortedSetView over this ImmutableArrayList.

Method Detail

equals

public boolean equals(java.lang.Object o)
Compares the specified object with this collection for equality.

While the Collection interface adds no stipulations to the general contract for the Object.equals, programmers who implement the Collection interface "directly" (in other words, create a class that is a Collection but is not a Set or a List) must exercise care if they choose to override the Object.equals. It is not necessary to do so, and the simplest course of action is to rely on Object's implementation, but the implementer may wish to implement a "value comparison" in place of the default "reference comparison." (The List and Set interfaces mandate such value comparisons.)

The general contract for the Object.equals method states that equals must be symmetric (in other words, a.equals(b) if and only if b.equals(a)). The contracts for List.equals and Set.equals state that lists are only equal to other lists, and sets to other sets. Thus, a custom equals method for a collection class that implements neither the List nor Set interface must return false when this collection is compared to any list or set. (By the same logic, it is not possible to write a class that correctly implements both the Set and List interfaces.)

Specified by:
equals in interface java.util.Collection
Specified by:
equals in interface java.util.Set
Overrides:
equals in class WrapperCollections.AbstractWrapperCollection
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)

hashCode

public int hashCode()
Returns the hash code value for this collection. While the Collection interface adds no stipulations to the general contract for the Object.hashCode method, programmers should take note that any class that overrides the Object.equals method must also override the Object.hashCode method in order to satisfy the general contract for the Object.hashCodemethod. In particular, c1.equals(c2) implies that c1.hashCode()==c2.hashCode().
Specified by:
hashCode in interface java.util.Collection
Specified by:
hashCode in interface java.util.Set
Overrides:
hashCode in class WrapperCollections.AbstractWrapperCollection
Returns:
the hash code value for this collection
See Also:
Object.hashCode(), Object.equals(Object)

toString

public java.lang.String toString()
Overrides:
toString in class WrapperCollections.AbstractWrapperCollection

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.0.0

E18683-01


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