Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client
11g Release 1 (11.1.1)

E17503-02

oracle.adfnmc.java.util
Class AbstractList

java.lang.Object
  extended by oracle.adfnmc.java.util.AbstractCollection
      extended by oracle.adfnmc.java.util.AbstractList
All Implemented Interfaces:
Iterable, Collection, List
Direct Known Subclasses:
AbstractSequentialList, ArrayList, Vector

public abstract class AbstractList
extends AbstractCollection
implements List

AbstractList is an abstract implementation of the List interface, optimized for a backing store which supports random access. This implementation does not support adding or replacing. A subclass must implement the abstract methods get() and size().

Since:
1.2

Field Summary
protected  int modCount
           
 
Constructor Summary
protected AbstractList()
          Constructs a new instance of this AbstractList.
 
Method Summary
 void add(int location, java.lang.Object object)
          Inserts the specified object into this List at the specified location.
 boolean add(java.lang.Object object)
          Adds the specified object at the end of this List.
 boolean addAll(int location, Collection collection)
          Inserts the objects in the specified Collection at the specified location in this List.
 void clear()
          Removes all elements from this List, leaving it empty.
 boolean equals(java.lang.Object object)
          Compares the specified object to this List and answer if they are equal.
abstract  java.lang.Object get(int location)
          Answers the element at the specified location in this List.
 int hashCode()
          Answers an integer hash code for the receiver.
 int indexOf(java.lang.Object object)
          Searches this List for the specified object and returns the index of the first occurrence.
 Iterator iterator()
          Answers an Iterator on the elements of this List.
 int lastIndexOf(java.lang.Object object)
          Searches this List for the specified object and returns the index of the last occurrence.
 ListIterator listIterator()
          Answers a ListIterator on the elements of this List.
 ListIterator listIterator(int location)
          Answers a ListIterator on the elements of this List.
 java.lang.Object remove(int location)
          Removes the object at the specified location from this List.
protected  void removeRange(int start, int end)
          Removes the objects in the specified range from the start to the, but not including, end index.
 java.lang.Object set(int location, java.lang.Object object)
          Replaces the element at the specified location in this List with the specified object.
 List subList(int start, int end)
          Returns a part of consecutive elements of this list as a view.
 
Methods inherited from class oracle.adfnmc.java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, size, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface oracle.adfnmc.java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, size, toArray
 
Methods inherited from interface oracle.adfnmc.java.util.Collection
toArray
 

Field Detail

modCount

protected transient int modCount
Constructor Detail

AbstractList

protected AbstractList()
Constructs a new instance of this AbstractList.

Method Detail

add

public void add(int location,
                java.lang.Object object)
Inserts the specified object into this List at the specified location. The object is inserted before any previous element at the specified location. If the location is equal to the size of this List, the object is added at the end.

Specified by:
add in interface List
Parameters:
location - the index at which to insert
object - the object to add
Throws:
java.lang.UnsupportedOperationException - when adding to this List is not supported
java.lang.ClassCastException - when the class of the object is inappropriate for this List
java.lang.IllegalArgumentException - when the object cannot be added to this List
java.lang.IndexOutOfBoundsException - when location < 0 || >= size()

add

public boolean add(java.lang.Object object)
Adds the specified object at the end of this List.

Specified by:
add in interface Collection
Specified by:
add in interface List
Overrides:
add in class AbstractCollection
Parameters:
object - the object to add
Returns:
true
Throws:
java.lang.UnsupportedOperationException - when adding to this List is not supported
java.lang.ClassCastException - when the class of the object is inappropriate for this List
java.lang.IllegalArgumentException - when the object cannot be added to this List

addAll

public boolean addAll(int location,
                      Collection collection)
Inserts the objects in the specified Collection at the specified location in this List. The objects are added in the order they are returned from the Collection iterator.

Specified by:
addAll in interface List
Parameters:
location - the index at which to insert
collection - the Collection of objects
Returns:
true if this List is modified, false otherwise
Throws:
java.lang.UnsupportedOperationException - when adding to this List is not supported
java.lang.ClassCastException - when the class of an object is inappropriate for this List
java.lang.IllegalArgumentException - when an object cannot be added to this List
java.lang.IndexOutOfBoundsException - when location < 0 || >= size()

clear

public void clear()
Removes all elements from this List, leaving it empty.

Specified by:
clear in interface Collection
Specified by:
clear in interface List
Overrides:
clear in class AbstractCollection
Throws:
java.lang.UnsupportedOperationException - when removing from this List is not supported
See Also:
List.isEmpty(), List.size()

equals

public boolean equals(java.lang.Object object)
Compares the specified object to this List and answer if they are equal. The object must be a List which contains the same objects in the same order.

Specified by:
equals in interface Collection
Specified by:
equals in interface List
Overrides:
equals in class java.lang.Object
Parameters:
object - the object to compare with this object
Returns:
true if the specified object is equal to this List, false otherwise
See Also:
hashCode()

get

public abstract java.lang.Object get(int location)
Answers the element at the specified location in this List.

Specified by:
get in interface List
Parameters:
location - the index of the element to return
Returns:
the element at the specified index
Throws:
java.lang.IndexOutOfBoundsException - when location < 0 || >= size()

hashCode

public int hashCode()
Answers an integer hash code for the receiver. Objects which are equal answer the same value for this method.

Specified by:
hashCode in interface Collection
Specified by:
hashCode in interface List
Overrides:
hashCode in class java.lang.Object
Returns:
the receiver's hash
See Also:
equals(java.lang.Object)

indexOf

public int indexOf(java.lang.Object object)
Searches this List for the specified object and returns the index of the first occurrence.

Specified by:
indexOf in interface List
Parameters:
object - the object to search for
Returns:
the index of the first occurrence of the object

iterator

public Iterator iterator()
Answers an Iterator on the elements of this List. The elements are iterated in the same order that they occur in the List.

Specified by:
iterator in interface Iterable
Specified by:
iterator in interface Collection
Specified by:
iterator in interface List
Specified by:
iterator in class AbstractCollection
Returns:
an Iterator on the elements of this List
See Also:
Iterator

lastIndexOf

public int lastIndexOf(java.lang.Object object)
Searches this List for the specified object and returns the index of the last occurrence.

Specified by:
lastIndexOf in interface List
Parameters:
object - the object to search for
Returns:
the index of the last occurrence of the object

listIterator

public ListIterator listIterator()
Answers a ListIterator on the elements of this List. The elements are iterated in the same order that they occur in the List.

Specified by:
listIterator in interface List
Returns:
a ListIterator on the elements of this List
See Also:
ListIterator

listIterator

public ListIterator listIterator(int location)
Answers a ListIterator on the elements of this List. The elements are iterated in the same order that they occur in the List. The iteration starts at the specified location.

Specified by:
listIterator in interface List
Parameters:
location - the index at which to start the iteration
Returns:
a ListIterator on the elements of this List
Throws:
java.lang.IndexOutOfBoundsException - when location < 0 || >= size()
See Also:
ListIterator

remove

public java.lang.Object remove(int location)
Removes the object at the specified location from this List.

Specified by:
remove in interface List
Parameters:
location - the index of the object to remove
Returns:
the removed object
Throws:
java.lang.UnsupportedOperationException - when removing from this List is not supported
java.lang.IndexOutOfBoundsException - when location < 0 || >= size()

removeRange

protected void removeRange(int start,
                           int end)
Removes the objects in the specified range from the start to the, but not including, end index.

Parameters:
start - the index at which to start removing
end - the index one past the end of the range to remove
Throws:
java.lang.UnsupportedOperationException - when removing from this List is not supported
java.lang.IndexOutOfBoundsException - when start < 0

set

public java.lang.Object set(int location,
                            java.lang.Object object)
Replaces the element at the specified location in this List with the specified object.

Specified by:
set in interface List
Parameters:
location - the index at which to put the specified object
object - the object to add
Returns:
the previous element at the index
Throws:
java.lang.UnsupportedOperationException - when replacing elements in this List is not supported
java.lang.ClassCastException - when the class of an object is inappropriate for this List
java.lang.IllegalArgumentException - when an object cannot be added to this List
java.lang.IndexOutOfBoundsException - when location < 0 || >= size()

subList

public List subList(int start,
                    int end)
Returns a part of consecutive elements of this list as a view. From start (inclusive), to end(exclusive). The returned view will be of zero length if start equals end. Any change occurs in the returned subList will be reflected to the original list, and vice-versa. All the supported optional operations by the original list will also be supported by this subList. This method can be used as a handy method to do some operations on a sub range of the original list. For example: list.subList(from, to).clear(); If the original list is modified other than through the returned subList, the behavior of the returned subList becomes undefined. The returned subList is a subclass of AbstractList. The subclass stores offset, size of itself, and modCount of the original list. If the original list implements RandomAccess interface, the returned subList also implements RandomAccess interface. The subList's set(int, Object), get(int), add(int, Object), remove(int), addAll(int, Collection) and removeRange(int, int) methods first check the bounds, adjust offsets and then call the corresponding methods of the original AbstractList. addAll(Collection c) method of the returned subList calls the original addAll(offset + size, c). The listIterator(int) method of the subList wraps the original list iterator. The iterator() method of the subList invokes the original listIterator() method, and the size() method merely returns the size of the subList. All methods will throw a ConcurrentModificationException if the modCount of the original list is not equal to the expected value.

Specified by:
subList in interface List
Parameters:
start - start index of the subList, include start
end - end index of the subList, exclude end
Returns:
a subList view of this list start from start (inclusive), end with end (exclusive)
Throws:
java.lang.IndexOutOfBoundsException - when (start < 0 || end > size())
java.lang.IllegalArgumentException - when (start > end)

Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client
11g Release 1 (11.1.1)

E17503-02

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