|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--java.util.AbstractCollection
|
+--java.util.AbstractList
|
+--net.sf.molae.pipe.hash.HashList
A list where the index of each element equals its hash code.
| Fields inherited from class java.util.AbstractList |
modCount |
| Constructor Summary | |
HashList(List base)
Constructs a HashList object. |
|
| Method Summary | |
boolean |
add(Object o)
Appends the specified element to the end of this List (optional operation). |
void |
clear()
Removes all of the elements from this collection (optional operation). |
boolean |
contains(Object o)
Returns true if this collection contains the specified element. |
Object |
get(int index)
Returns the element at the specified position in this list. |
int |
indexOf(Object o)
Returns the index in this list of the first occurence of the specified element, or -1 if the list does not contain this element. |
boolean |
isEmpty()
Returns true if this collection contains no elements. |
int |
lastIndexOf(Object o)
Returns the index in this list of the last occurence of the specified element, or -1 if the list does not contain this element. |
Object |
set(int index,
Object element)
Replaces the element at the specified position in this list with the specified element (optional operation). |
int |
size()
Returns the number of elements in this collection. |
| Methods inherited from class java.util.AbstractList |
add, addAll, equals, hashCode, iterator, listIterator, listIterator, remove, removeRange, subList |
| Methods inherited from class java.util.AbstractCollection |
addAll, containsAll, remove, removeAll, retainAll, toArray, toArray, toString |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.List |
addAll, containsAll, remove, removeAll, retainAll, toArray, toArray |
| Constructor Detail |
public HashList(List base)
base - the underling lists where the elements are stored.| Method Detail |
public int size()
size in class AbstractCollectionpublic boolean isEmpty()
isEmpty in class AbstractCollectionpublic boolean contains(Object o)
contains in class AbstractCollectiono - object to be checked for containment in this collection.public boolean add(Object o)
This implementation calls the corresponding method of the base list if the hash code of the specified element equals the size of the list.
add in class AbstractListo - element to be appended to this list.UnsupportedOperationException - if the add method is not
supported by the base list.ClassCastException - if the class of the specified element
prevents it from being added to the base list.IllegalArgumentException - some aspect of this element prevents
it from being added to the base list or
if the hash code of the specified element is not equal to the size of
this list.public void clear()
clear in class AbstractListUnsupportedOperationException - if the clear method
is not supported by the base listpublic Object get(int index)
get in class AbstractListindex - index of element to return.IndexOutOfBoundsException - if the given index is out of range
(index < 0 || index >= size()).
public Object set(int index,
Object element)
This implementation checks the hash code of the new element first.
set in class AbstractListindex - index of element to replace.element - element to be stored at the specified position.UnsupportedOperationException - if the set method is not
supported by the base list.ClassCastException - if the class of the specified element
prevents it from being added to the base list.IllegalArgumentException - if some aspect of the specified
element prevents it from being added to this list.IndexOutOfBoundsException - if the specified index is out of
range (index < 0 || index >= size()).public int indexOf(Object o)
indexOf in class AbstractListo - element to search for.public int lastIndexOf(Object o)
indexOf.lastIndexOf in class AbstractListo - element to search for.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||