| Modifier and Type | Field and Description |
|---|---|
| protected ArrayList | elements
Track the elements as they are added to the set |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | add(T
element to be added to this set value)Overrides java. Implements java. |
| public void | clear()
Overrides java. Implements java. |
| public Object | clone()
Overrides java. HashSet instance: the elements
themselves are not cloned.
|
| public List | |
| public boolean | equals(Object
object to be compared for equality with this set o)Overrides java. Implements java. |
| public T | |
| public int | hashCode()
Overrides java. Implements java. |
| public Iterator | iterator()
Overrides java. Implements java. |
| public boolean | |
| public boolean | remove(Object
object to be removed from this set, if present o)Overrides java. Implements java. |
| public T | set(int i, T value)
Replace an existing value with a new value; updates the element list and the hash table, but not the key as that has not changed. |
| public Object[] | toArray()
Overrides java. Implements java. |
| public String | toString()
Overrides java. |
| elements | back to summary |
|---|---|
| protected ArrayList<T> elements Track the elements as they are added to the set | |
| OrderedHashSet | back to summary |
|---|---|
| public OrderedHashSet() | |
| add | back to summary |
|---|---|
| public boolean add(T value) Overrides java. Implements java. Add a value to list; keep in hashtable for consistency also; Key is object itself. Good for say asking if a certain string is in a list of strings.
| |
| clear | back to summary |
|---|---|
| public void clear() Overrides java. Implements java. Doc from java. Removes all of the elements from this set (optional operation). The set will be empty after this call returns.
| |
| clone | back to summary |
|---|---|
| public Object clone() Overrides java. Doc from java. Returns a shallow copy of this | |
| elements | back to summary |
|---|---|
| public List Return the List holding list of table elements. Note that you are NOT getting a copy so don't write to the list. | |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Implements java. Doc from java. Compares the specified object with this set for equality. Returns
| |
| get | back to summary |
|---|---|
| public T get(int i) | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Implements java. Doc from java. Returns the hash code value for this set. The hash code of a set is
defined to be the sum of the hash codes of the elements in the set,
where the hash code of a
| |
| iterator | back to summary |
|---|---|
| public Iterator Overrides java. Implements java. Doc from java. Returns an iterator over the elements in this set. The elements are returned in no particular order (unless this set is an instance of some class that provides a guarantee). | |
| remove | back to summary |
|---|---|
| public boolean remove(int i) | |
| remove | back to summary |
|---|---|
| public boolean remove(Object o) Overrides java. Implements java. Doc from java. Removes the specified element from this set if it is present
(optional operation). More formally, removes an element | |
| set | back to summary |
|---|---|
| public T set(int i, T value) Replace an existing value with a new value; updates the element list and the hash table, but not the key as that has not changed. | |
| toArray | back to summary |
|---|---|
| public Object[] toArray() Overrides java. Implements java. Doc from java. Returns an array containing all of the elements in this set. If this set makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order. The returned array will be "safe" in that no references to it are maintained by this set. (In other words, this method must allocate a new array even if this set is backed by an array). The caller is thus free to modify the returned array. This method acts as bridge between array-based and collection-based APIs. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of this collection. The string
representation consists of a list of the collection's elements in the
order they are returned by its iterator, enclosed in square brackets
( | |