displayablecollections
Class DisplayableHashSet<E>

java.lang.Object
  extended by java.util.Observable
      extended by displayablecollections.DisplayableHashSet<E>
All Implemented Interfaces:
DisplayableCollection<E>, DisplayableSet<E>, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<E>, java.util.Collection<E>, java.util.Set<E>
Direct Known Subclasses:
DisplayableLinkedHashSet

public class DisplayableHashSet<E>
extends java.util.Observable
implements java.lang.Cloneable, java.io.Serializable

An DisplayableHashSet encapsulates HashSet and allows it to be displayed by a JList

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface displayablecollections.DisplayableCollection
DisplayableCollection.CollectionChangedNotification<E>
 
Constructor Summary
DisplayableHashSet()
          Constructs a new empty set
DisplayableHashSet(java.util.Collection<? extends E> c)
          Constructs a new set containing the elements in the specified collection
DisplayableHashSet(int initialCapacity)
          Constructs a new empty set whose backing HashMap has the specified initial capacity
DisplayableHashSet(int initialCapacity, float loadFactor)
          Constructs a new empty set whose backing HashMap has the specified initial capacity and load factor
 
Method Summary
 boolean add(E o)
           
 boolean addAll(java.util.Collection<? extends E> c)
           
 void clear()
           
 boolean contains(java.lang.Object o)
           
 boolean containsAll(java.util.Collection<?> c)
           
 boolean equals(java.lang.Object o)
           
 int hashCode()
           
 boolean isEmpty()
           
 java.util.Iterator<E> iterator()
           
 javax.swing.ListModel listModel()
          Create a list model for displaying this collection in a JList.
 boolean remove(java.lang.Object o)
           
 boolean removeAll(java.util.Collection<?> c)
           
 boolean retainAll(java.util.Collection<?> c)
           
 int size()
           
 java.lang.Object[] toArray()
           
<T> T[]
toArray(T[] a)
           
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface displayablecollections.DisplayableCollection
addObserver, deleteObservers, listModel
 
Methods inherited from interface java.util.Set
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Constructor Detail

DisplayableHashSet

public DisplayableHashSet()
Constructs a new empty set


DisplayableHashSet

public DisplayableHashSet(java.util.Collection<? extends E> c)
Constructs a new set containing the elements in the specified collection

Parameters:
c - the collection whose elements are to be placed in the set

DisplayableHashSet

public DisplayableHashSet(int initialCapacity)
Constructs a new empty set whose backing HashMap has the specified initial capacity

Parameters:
initialCapacity - the initial capacity

DisplayableHashSet

public DisplayableHashSet(int initialCapacity,
                          float loadFactor)
Constructs a new empty set whose backing HashMap has the specified initial capacity and load factor

Parameters:
initialCapacity - the initial capacity
loadFactor - the load factor
Method Detail

listModel

public javax.swing.ListModel listModel()
Description copied from interface: DisplayableCollection
Create a list model for displaying this collection in a JList. The result of calling toString() is what will actually be displayed for each element. There will be no necessary connection between the order of display and any order in the collection, since this method can be invoked on any collection implementing this interface. (For collections having an inherent order, orderedListModel can be used instead.)

Specified by:
listModel in interface DisplayableCollection<E>
See Also:
orderedListModel() in DisplayableList and DisplayableSortedSet

add

public boolean add(E o)
Specified by:
add in interface java.util.Collection<E>

addAll

public boolean addAll(java.util.Collection<? extends E> c)
Specified by:
addAll in interface java.util.Collection<E>

clear

public void clear()
Specified by:
clear in interface java.util.Collection<E>

contains

public boolean contains(java.lang.Object o)
Specified by:
contains in interface java.util.Collection<E>

containsAll

public boolean containsAll(java.util.Collection<?> c)
Specified by:
containsAll in interface java.util.Collection<E>

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in interface java.util.Collection<E>
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Collection<E>
Overrides:
hashCode in class java.lang.Object

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection<E>

iterator

public java.util.Iterator<E> iterator()
Specified by:
iterator in interface java.lang.Iterable<E>
Specified by:
iterator in interface java.util.Collection<E>

remove

public boolean remove(java.lang.Object o)
Specified by:
remove in interface java.util.Collection<E>

removeAll

public boolean removeAll(java.util.Collection<?> c)
Specified by:
removeAll in interface java.util.Collection<E>

retainAll

public boolean retainAll(java.util.Collection<?> c)
Specified by:
retainAll in interface java.util.Collection<E>

size

public int size()
Specified by:
size in interface java.util.Collection<E>

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection<E>

toArray

public <T> T[] toArray(T[] a)
Specified by:
toArray in interface java.util.Collection<E>