Class StringHashedSet

  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byjava.util.ArrayList
              extended byorg.tritonus.share.ArraySet
                  extended byorg.tritonus.share.StringHashedSet
All Implemented Interfaces:
Cloneable, Collection, Iterable, List, RandomAccess, Serializable, Set

public class StringHashedSet
extends ArraySet

A set where the elements are uniquely referenced by their string representation as given by the objects toString() method. No 2 objects with the same toString() can be in the set.

The contains(Object elem) and get(Object elem) methods can be called with Strings as elem parameter. For get(Object elem), the object that has been added is returned, and not its String representation.

Though it's possible to store Strings as objects in this class, it doesn't make sense as you could use ArraySet for that equally well.

You shouldn't use the ArrayList specific functions like those that take index parameters.

It is not possible to add null elements.

See Also:
Serialized Form

Field Summary
Fields inherited from class java.util.AbstractList
Constructor Summary
StringHashedSet(Collection c)
Method Summary
 boolean add(Object elem)
 boolean contains(Object elem)
 Object get(Object elem)
Methods inherited from class org.tritonus.share.ArraySet
add, add, set
Methods inherited from class java.util.ArrayList
addAll, addAll, clear, clone, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, size, toArray, toArray, trimToSize
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Set
addAll, clear, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList

Constructor Detail


public StringHashedSet()


public StringHashedSet(Collection c)
Method Detail


public boolean add(Object elem)
add in class ArraySet


public boolean contains(Object elem)
Specified by:
contains in interface Set
contains in class ArrayList


public Object get(Object elem)