|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection
java.util.AbstractList
com.tangosol.util.ImmutableArrayList
public class ImmutableArrayList
Implementation of the Collection Framework interface "List" in a read- only fashion on top of an array data structure.
This class also implements the Set interface, although the contents are not checked to determine whether each element is unique. It is the responsibility of the user to ensure that the elements are unique if the object is used as a Set.
Field Summary |
---|
Fields inherited from class java.util.AbstractList |
---|
modCount |
Constructor Summary | |
---|---|
ImmutableArrayList(Collection collection)
Construct a List containing the elements of the specified Collection. |
|
ImmutableArrayList(Object[] ao)
Construct a List from an Array. |
Method Summary | |
---|---|
Object |
clone()
Create a clone of the ImmutableArrayList. |
Comparator |
comparator()
Returns the comparator associated with this sorted set, or null if it uses its elements' natural ordering. |
int |
compareTo(Object o)
Compare this ImmutableArrayList with the passed Object to determine order. |
boolean |
contains(Object o)
Returns true if this List contains the specified element. |
boolean |
equals(Object o)
Compare this Collection / List / Set / SortedSet with some other Object and determine if the caller would believe this Object to equal that other Object. |
Object |
first()
Returns the first element currently in this sorted set. |
Object |
get(int i)
Returns the element at the specified position in this List. |
protected Map |
getValueIndex()
Create a reverse index from value to position if this List is big enough to warrant it. |
SortedSet |
headSet(Object toElement)
Returns a view of the portion of this sorted set whose elements are found in the set in a position before toElement. |
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. |
Iterator |
iterator()
Returns an iterator over the elements in this list in proper sequence. |
Object |
last()
Returns the last element currently in this sorted set. |
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. |
int |
size()
Returns the number of elements in this List. |
SortedSet |
subSet(Object fromElement,
Object toElement)
Returns a view of the portion of this sorted set whose elements are found in the set in a position at and after the position of fromElement and in a position before toElement. |
SortedSet |
tailSet(Object fromElement)
Returns a view of the portion of this sorted set whose elements are found in the set in a position at and after the position of fromElement. |
Object[] |
toArray()
Returns an array containing all of the elements in this List in the order that the elements occur in the List. |
Object[] |
toArray(Object[] a)
Returns an array with a runtime type is that of the specified array and that contains all of the elements in this List. |
Methods inherited from class java.util.AbstractList |
---|
add, add, addAll, clear, hashCode, listIterator, listIterator, remove, removeRange, set, subList |
Methods inherited from class java.util.AbstractCollection |
---|
addAll, containsAll, isEmpty, remove, removeAll, retainAll, toString |
Methods inherited from interface java.util.List |
---|
add, add, addAll, addAll, clear, containsAll, hashCode, isEmpty, listIterator, listIterator, remove, remove, removeAll, retainAll, set, subList |
Constructor Detail |
---|
public ImmutableArrayList(Object[] ao)
ao
- a non-null array of Objectspublic ImmutableArrayList(Collection collection)
collection
- the Collection to fill this List fromMethod Detail |
---|
public int size()
size
in interface Collection
size
in interface List
size
in interface Set
size
in class AbstractCollection
public Object get(int i)
get
in interface List
get
in class AbstractList
i
- the index of the element to return
IndexOutOfBoundsException
- if the index is out of range (index
< 0 || index >= size()).public int indexOf(Object o)
indexOf
in interface List
indexOf
in class AbstractList
o
- element to search for.
public int lastIndexOf(Object o)
lastIndexOf
in interface List
lastIndexOf
in class AbstractList
o
- element to search for.
public boolean contains(Object o)
contains
in interface Collection
contains
in interface List
contains
in interface Set
contains
in class AbstractCollection
o
- element whose presence in this List is to be tested
public Object[] toArray()
toArray
in interface Collection
toArray
in interface List
toArray
in interface Set
toArray
in class AbstractCollection
public Object[] toArray(Object[] a)
If the List fits in the specified array with room to spare (i.e., the array has more elements than the List), the element in the array immediately following the end of the last element is set to null. This is useful in determining the length of the List only if the caller knows that the List does not contain any null elements.)
toArray
in interface Collection
toArray
in interface List
toArray
in interface Set
toArray
in class AbstractCollection
a
- the array into which the elements of the List are to be
stored, if it is big enough; otherwise, a new array of the
same runtime type is allocated for this purpose
ArrayStoreException
- if the runtime type of the specified array
is not a supertype of the runtime type of every element in this
Listpublic Iterator iterator()
iterator
in interface Iterable
iterator
in interface Collection
iterator
in interface List
iterator
in interface Set
iterator
in class AbstractList
public Comparator comparator()
comparator
in interface SortedSet
public Object first()
first
in interface SortedSet
NoSuchElementException
- if the sorted set is emptypublic Object last()
last
in interface SortedSet
NoSuchElementException
- if the sorted set is emptypublic SortedSet headSet(Object toElement)
headSet
in interface SortedSet
toElement
- high endpoint (exclusive) of the headSet
IllegalArgumentException
- if toElement is not found in
the SortedSetpublic SortedSet tailSet(Object fromElement)
tailSet
in interface SortedSet
fromElement
- the first element to include in the resulting set
IllegalArgumentException
- if fromElement is not found
in the SortedSetpublic SortedSet subSet(Object fromElement, Object toElement)
subSet
in interface SortedSet
fromElement
- the first element to include in the resulting settoElement
- the first element following fromElement to
not include in the resulting set
IllegalArgumentException
- if either fromElement or
toElement is not found in the SortedSetpublic Object clone()
public int compareTo(Object o)
compareTo
in interface Comparable
o
- the Object to be compared
ClassCastException
- if the specified object does not implement
the List
interface, some elements of either list do
not implement the Comparable
interface, or if an
element object type prevents it from being compared to another
element
NullPointerException
- if the specified List itself or any of its
elements are nullpublic boolean equals(Object o)
equals
in interface Collection
equals
in interface List
equals
in interface Set
equals
in class AbstractList
o
- some other Object that is likely to be a Collection or some
more specific type (with its related overloaded definition of
what it thinks that equals() means)
protected Map getValueIndex()
|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |