|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.pf.util.OrderedCollection
public class OrderedCollection
A collection that supports similar methods to the list interface but it
starts with index 1 and ends with element index size() !
IT IS NOT ZERO BASED !
| Constructor Summary | |
|---|---|
OrderedCollection()
Initialize the new instance with default values. |
|
OrderedCollection(int initialCapacity)
Initialize the new instance with a given initial capacity. |
|
OrderedCollection(java.util.List list)
Initialize the new instance with default values. |
|
| Method Summary | |
|---|---|
void |
add(int index,
java.lang.Object element)
Inserts the specified element at the specified position in this list. |
boolean |
add(java.lang.Object o)
Appends the specified element to the end of this list. |
boolean |
addAll(java.util.Collection c)
Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator (optional operation). |
boolean |
addAll(int index,
java.util.Collection c)
Inserts all of the elements in the specified collection into this list at the specified position (optional operation). |
java.lang.Object |
at(int index)
Returns the element at the specified position in this list. |
java.lang.Object |
atPut(int index,
java.lang.Object element)
Replaces the element at the specified position in this list with the specified element. |
void |
clear()
Removes all of the elements from this list. |
boolean |
contains(java.lang.Object o)
Returns true if this list contains the specified element. |
boolean |
containsAll(java.util.Collection c)
Returns true if this list contains all of the elements of the specified collection. |
java.lang.Object |
detect_(Block1 aBlock)
Loop over all the receiver's elements and call the given blocks eval() - method for each. |
java.lang.Object |
do_(Block1 aBlock)
Loop over all the receiver's elements and call the given blocks eval() - method for each. |
boolean |
equals(java.lang.Object o)
Compares the specified object with this list for equality. |
java.lang.Object |
first()
Returns the first element of the receiver. |
java.lang.Object |
get(int index)
Returns the element at the specified position in this list. |
int |
hashCode()
Returns the hash code value for this list. |
int |
indexOf(java.lang.Object o)
Returns the index in this list of the first occurrence of the specified element, or 0 if this list does not contain this element. |
boolean |
isEmpty()
Returns true if this list contains no elements. |
java.util.Iterator |
iterator()
Returns an iterator over the elements in this list in proper sequence. |
java.lang.Object |
last()
Returns the last element of the receiver. |
int |
lastIndexOf(java.lang.Object o)
Returns the index in this list of the last occurrence of the specified element, or 0 if this list does not contain this element. |
java.util.ListIterator |
listIterator()
Returns a list iterator of the elements in this list (in proper sequence). |
java.util.ListIterator |
listIterator(int index)
Returns a list iterator of the elements in this list (in proper sequence), starting at the specified position in this list. |
java.lang.Object |
remove(int index)
Removes the element at the specified position in this list. |
boolean |
remove(java.lang.Object o)
Removes the first occurrence in this list of the specified element (optional operation). |
boolean |
removeAll(java.util.Collection c)
Removes from this list all the elements that are contained in the specified collection. |
boolean |
retainAll(java.util.Collection c)
Retains only the elements in this list that are contained in the specified collection. |
java.lang.Object |
set(int index,
java.lang.Object element)
Replaces the element at the specified position in this list with the specified element. |
int |
size()
Returns the number of elements in this list. |
java.util.List |
subList(int fromIndex,
int toIndex)
Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, inclusive. |
java.lang.Object[] |
toArray()
Returns an array containing all of the elements in this list in proper sequence. |
java.lang.Object[] |
toArray(java.lang.Object[] a)
Returns an array containing all of the elements in this list in proper sequence; the runtime type of the returned array is that of the specified array. |
java.util.Vector |
toVector()
Returns a copy of this collection in a Vector |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public OrderedCollection()
public OrderedCollection(int initialCapacity)
public OrderedCollection(java.util.List list)
| Method Detail |
|---|
public int size()
size in interface java.util.Collectionpublic boolean isEmpty()
isEmpty in interface java.util.Collectionpublic boolean contains(java.lang.Object o)
contains in interface java.util.Collectiono - - element whose presence in this list is to be tested.public java.util.Iterator iterator()
iterator in interface java.lang.Iterableiterator in interface java.util.Collectionpublic java.lang.Object[] toArray()
toArray in interface java.util.Collection
public java.lang.Object[] toArray(java.lang.Object[] a)
throws java.lang.ArrayStoreException
toArray in interface java.util.Collectiona - - the array into which the elements of this list are to be stored,
if it is big enough; otherwise, a new array of the same runtime type
is allocated for this purpose.
java.lang.ArrayStoreException - - if the runtime type of the specified array is not
a supertype of the runtime type of every element in this list.public boolean add(java.lang.Object o)
add in interface java.util.Collectiono - - element to be appended to this list.
public boolean remove(java.lang.Object o)
remove in interface java.util.Collectiono - - element to be removed from this list, if present.
public boolean containsAll(java.util.Collection c)
containsAll in interface java.util.Collectionc - - collection to be checked for containment in this list.
public boolean addAll(java.util.Collection c)
addAll in interface java.util.Collectionc - - collection whose elements are to be added to this list.
public boolean addAll(int index,
java.util.Collection c)
throws java.lang.IndexOutOfBoundsException
index - - index at which to insert first element from the specified collection.
( 1 <= index <= size() )c - - elements to be inserted into this list.
java.lang.IndexOutOfBoundsException - - if the index is out of range
(index < 1 || index > size()).public boolean removeAll(java.util.Collection c)
removeAll in interface java.util.Collectionc - - collection that defines which elements will be removed from this list.
public boolean retainAll(java.util.Collection c)
retainAll in interface java.util.Collectionc - - collection that defines which elements this set will retain.
public void clear()
clear in interface java.util.Collectionpublic boolean equals(java.lang.Object o)
equals in interface java.util.Collectionequals in class java.lang.Objecto - - the object to be compared for equality with this list.
public int hashCode()
hashCode in interface java.util.CollectionhashCode in class java.lang.Object
public java.lang.Object get(int index)
throws java.lang.IndexOutOfBoundsException
index - - index of element to return. ( 1 <= index <= size() )
java.lang.IndexOutOfBoundsException - - if the index is out of range
(index < 1 || index > size()).
public java.lang.Object set(int index,
java.lang.Object element)
throws java.lang.IndexOutOfBoundsException
index - - index of element to replace. ( 1 <= index <= size() )element - - element to be stored at the specified position.
java.lang.IndexOutOfBoundsException - - if the index is out of range
(index < 1 || index > size()).
public void add(int index,
java.lang.Object element)
throws java.lang.IndexOutOfBoundsException
index - - index at which the specified element is to be inserted.element - - element to be inserted.
java.lang.IndexOutOfBoundsException - - if the index is out of range
(index < 1 || index > size()).public java.lang.Object remove(int index)
index - - the index of the element to removed.
java.lang.IndexOutOfBoundsException - - if the index is out of range
(index < 1 || index > size()).public int indexOf(java.lang.Object o)
o - - element to search for.
public int lastIndexOf(java.lang.Object o)
o - - element to search for.
public java.util.ListIterator listIterator()
public java.util.ListIterator listIterator(int index)
throws java.lang.IndexOutOfBoundsException
index - - index of first element to be returned from the list iterator
(by a call to the next method).
java.lang.IndexOutOfBoundsException - - if the index is out of range
(index < 1 || index > size()).
public java.util.List subList(int fromIndex,
int toIndex)
throws java.lang.IndexOutOfBoundsException
fromIndex - - low endpoint (inclusive) of the subList.toIndex - - high endpoint (inclusive) of the subList.
java.lang.IndexOutOfBoundsException - - for an illegal endpoint index value
(fromIndex < 1 || toIndex > size() || fromIndex > toIndex).
public java.lang.Object at(int index)
throws java.lang.IndexOutOfBoundsException
index - - index of element to return. ( 1 <= index <= size() )
java.lang.IndexOutOfBoundsException - - if the index is out of range
(index < 1 || index > size()).
public java.lang.Object atPut(int index,
java.lang.Object element)
throws java.lang.IndexOutOfBoundsException
index - - index of element to replace. ( 1 <= index <= size() )element - - element to be stored at the specified position.
java.lang.IndexOutOfBoundsException - - if the index is out of range
(index < 1 || index > size()).public java.util.Vector toVector()
Vectorpublic java.lang.Object do_(Block1 aBlock)
aBlock - The block to evaluate for each element.
public java.lang.Object detect_(Block1 aBlock)
aBlock - The block to evaluate for each element.
public java.lang.Object first()
public java.lang.Object last()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||