|
Oracle® Coherence Java API Reference Release 3.6.0.0 E15725-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
java.util.AbstractCollection
com.tangosol.util.InflatableCollection
com.tangosol.util.InflatableList
public class InflatableList
Specialization of InflatableCollection that surfaces as a List.
Field Summary |
---|
Fields inherited from class com.tangosol.util.InflatableCollection |
---|
m_colValue, m_oValue, NO_VALUE |
Constructor Summary | |
---|---|
InflatableList() |
Method Summary | |
---|---|
void |
add(int i, Object o) Inserts the specified element at the specified position in this list (optional operation). |
boolean |
addAll(int i, Collection col) Inserts all of the elements in the specified collection into this list at the specified position (optional operation). |
boolean |
equals(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.) |
Object |
get(int i) Returns the element at the specified position in this list. |
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(). |
int |
indexOf(Object o) Returns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element. |
protected Collection |
instantiateCollection() Factory method used to create a new Collection. |
int |
lastIndexOf(Object o) Returns the index in this list of the last occurrence of the specified element, or -1 if this list does not contain this element. |
ListIterator |
listIterator() Returns a list iterator of the elements in this list (in proper sequence). |
ListIterator |
listIterator(int i) Returns a list iterator of the elements in this list (in proper sequence), starting at the specified position in this list. |
Object |
remove(int i) Removes the element at the specified position in this list (optional operation). |
Object |
set(int i, Object o) Replaces the element at the specified position in this list with the specified element (optional operation). |
List |
subList(int iFrom, int iTo) Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive. |
Methods inherited from class com.tangosol.util.InflatableCollection |
---|
add, clear, contains, iterator, remove, size, toArray, toArray |
Methods inherited from class java.util.AbstractCollection |
---|
addAll, containsAll, isEmpty, removeAll, retainAll, toString |
Methods inherited from interface java.util.List |
---|
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
Constructor Detail |
---|
public InflatableList()
Method Detail |
---|
public boolean equals(Object o)
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.)
equals
in interface Collection
equals
in interface List
equals
in class InflatableCollection
o
- Object to be compared for equality with this collection.Object.equals(Object)
, Set.equals(Object)
, List.equals(Object)
public int hashCode()
hashCode
in interface Collection
hashCode
in interface List
hashCode
in class InflatableCollection
Object.hashCode()
, Object.equals(Object)
public void add(int i, Object o)
add
in interface List
i
- index at which the specified element is to be inserted.o
- element to be inserted.public Object remove(int i)
remove
in interface List
i
- the index of the element to removed.public boolean addAll(int i, Collection col)
addAll
in interface List
i
- index at which to insert first element from the specified collection.col
- elements to be inserted into this list.public Object get(int i)
get
in interface List
i
- index of element to return.public int indexOf(Object o)
indexOf
in interface List
o
- element to search for.public int lastIndexOf(Object o)
lastIndexOf
in interface List
o
- element to search for.public ListIterator listIterator()
listIterator
in interface List
public ListIterator listIterator(int i)
listIterator
in interface List
i
- index of first element to be returned from the list iterator (by a call to the next method).public Object set(int i, Object o)
set
in interface List
i
- index of element to replace.o
- element to be stored at the specified position.public List subList(int iFrom, int iTo)
This method eliminates the need for explicit range operations (of the sort that commonly exist for arrays). Any operation that expects a list can be used as a range operation by passing a subList view instead of a whole list. For example, the following idiom removes a range of elements from a list:
list.subList(from, to).clear();Similar idioms may be constructed for indexOf and lastIndexOf, and all of the algorithms in the Collections class can be applied to a subList.
The semantics of the list returned by this method become undefined if the backing list (i.e., this list) is structurally modified in any way other than via the returned list. (Structural modifications are those that change the size of this list, or otherwise perturb it in such a fashion that iterations in progress may yield incorrect results.)
subList
in interface List
iFrom
- low endpoint (inclusive) of the subList.iTo
- high endpoint (exclusive) of the subList.protected Collection instantiateCollection()
instantiateCollection
in class InflatableCollection
|
Oracle® Coherence Java API Reference Release 3.6.0.0 E15725-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |