Package com.tangosol.util
Class ImmutableMultiList.ListView
- java.lang.Object
-
- com.tangosol.util.WrapperCollections.AbstractWrapperCollection<E>
-
- com.tangosol.util.WrapperCollections.AbstractWrapperList
-
- com.tangosol.util.ImmutableMultiList.ListView
-
- All Implemented Interfaces:
Serializable
,Iterable
,Collection
,List
- Enclosing class:
- ImmutableMultiList
protected class ImmutableMultiList.ListView extends WrapperCollections.AbstractWrapperList
ListView exposes the underlying ImmutableMultiList through theList
interface, maintaining correct equals() and hashCode() semantics- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.tangosol.util.WrapperCollections.AbstractWrapperCollection
m_colDelegate
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ListView()
Create a ListView over this ImmutableMultiList.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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, replaceAll, set, sort, subList
-
Methods inherited from class com.tangosol.util.WrapperCollections.AbstractWrapperCollection
add, addAll, clear, contains, containsAll, forEach, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
-
-
-
Method Detail
-
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 interfaceCollection
- Specified by:
equals
in interfaceList
- Overrides:
equals
in classWrapperCollections.AbstractWrapperCollection
- Parameters:
o
- the object to be compared for equality with this list.- Returns:
- true if the specified object is equal to this list.
-
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 interfaceCollection
- Specified by:
hashCode
in interfaceList
- Overrides:
hashCode
in classWrapperCollections.AbstractWrapperCollection
- Returns:
- the hash code value for this list.
- See Also:
Object.hashCode()
,Object.equals(Object)
,equals(Object)
-
-