Skip navigation links
com.tangosol.util
Class ImmutableMultiList.ListView
java.lang.Object
com.tangosol.util.WrapperCollections.AbstractWrapperCollection
com.tangosol.util.WrapperCollections.AbstractWrapperList
com.tangosol.util.ImmutableMultiList.ListView
- All Implemented Interfaces:
- Iterable, Collection, List
- Enclosing class:
- ImmutableMultiList
-
protected class ImmutableMultiList.ListView
- extends WrapperCollections.AbstractWrapperList
ListView exposes the underlying ImmutableMultiList through the List
interface, maintaining correct equals() and hashCode() semantics
Method Summary |
boolean |
equals(Object o)
Compares the specified object with this list for equality. |
int |
hashCode()
Returns the hash code value for this list. |
Methods inherited from class com.tangosol.util.WrapperCollections.AbstractWrapperList |
add, addAll, get, getDelegate, indexOf, lastIndexOf, listIterator, listIterator, remove, set, subList |
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.List |
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
ImmutableMultiList.ListView
protected ImmutableMultiList.ListView()
- Create a ListView over this ImmutableMultiList.
equals
public boolean equals(Object o)
- Compares the specified object with this list for equality. Returns true if and only if the specified object is also a list, both lists have the same size, and all corresponding pairs of elements in the two lists are equal. (Two elements e1 and e2 are equal if (e1==null ? e2==null : e1.equals(e2)).) In other words, two lists are defined to be equal if they contain the same elements in the same order. This definition ensures that the equals method works properly across different implementations of the List interface.
-
- Specified by:
equals
in interface Collection
- Specified by:
equals
in interface List
- Overrides:
equals
in class WrapperCollections.AbstractWrapperCollection
-
- Parameters:
o
- the object to be compared for equality with this list.
- Returns:
- true if the specified object is equal to this list.
- See Also:
Object.equals(Object)
, Set.equals(Object)
, List.equals(Object)
hashCode
public int hashCode()
- Returns the hash code value for this list. The hash code of a list is defined to be the result of the following calculation:
hashCode = 1;
Iterator i = list.iterator();
while (i.hasNext()) {
Object obj = i.next();
hashCode = 31*hashCode + (obj==null ? 0 : obj.hashCode());
}
This ensures that list1.equals(list2) implies that list1.hashCode()==list2.hashCode() for any two lists, list1 and list2, as required by the general contract of Object.hashCode.
-
- Specified by:
hashCode
in interface Collection
- Specified by:
hashCode
in interface List
- Overrides:
hashCode
in class WrapperCollections.AbstractWrapperCollection
-
- Returns:
- the hash code value for this list.
- See Also:
Object.hashCode()
, Object.equals(Object)
, equals(Object)
Skip navigation links
Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.