net.sf.adf.util
Class LinkedSet<T>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<T>
          extended by net.sf.adf.util.LinkedSet<T>
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<T>, java.util.Collection<T>, java.util.Set<T>

public class LinkedSet<T>
extends java.util.AbstractSet<T>
implements java.util.Set<T>, java.io.Serializable, java.lang.Cloneable

A simple implementation of a Set using a Linked list.

Author:
Catalin Hritcu
See Also:
Serialized Form

Constructor Summary
LinkedSet()
           
LinkedSet(java.util.Collection<T> c)
           
 
Method Summary
 boolean add(java.lang.Object o)
           
 void clear()
           
 java.lang.Object clone()
          Returns a shallow copy of this LinkedSet.
 boolean equals(java.lang.Object o)
           
 int hashCode()
           
 java.util.Iterator<T> iterator()
           
 boolean remove(java.lang.Object o)
           
 int size()
           
 java.lang.Object[] toArray()
           
 java.lang.Object[] toArray(java.lang.Object[] arr)
           
 
Methods inherited from class java.util.AbstractSet
removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, retainAll, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll, contains, containsAll, isEmpty, removeAll, retainAll
 

Constructor Detail

LinkedSet

public LinkedSet()

LinkedSet

public LinkedSet(java.util.Collection<T> c)
Method Detail

add

public boolean add(java.lang.Object o)
Specified by:
add in interface java.util.Collection<T>
Specified by:
add in interface java.util.Set<T>
Overrides:
add in class java.util.AbstractCollection<T>

clear

public void clear()
Specified by:
clear in interface java.util.Collection<T>
Specified by:
clear in interface java.util.Set<T>
Overrides:
clear in class java.util.AbstractCollection<T>

clone

public java.lang.Object clone()
Returns a shallow copy of this LinkedSet. (The elements themselves are not cloned.)

Overrides:
clone in class java.lang.Object
Returns:
a shallow copy of this LinkedSet.

equals

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

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Collection<T>
Specified by:
hashCode in interface java.util.Set<T>
Overrides:
hashCode in class java.util.AbstractSet<T>

iterator

public java.util.Iterator<T> iterator()
Specified by:
iterator in interface java.lang.Iterable<T>
Specified by:
iterator in interface java.util.Collection<T>
Specified by:
iterator in interface java.util.Set<T>
Specified by:
iterator in class java.util.AbstractCollection<T>

remove

public boolean remove(java.lang.Object o)
Specified by:
remove in interface java.util.Collection<T>
Specified by:
remove in interface java.util.Set<T>
Overrides:
remove in class java.util.AbstractCollection<T>

size

public int size()
Specified by:
size in interface java.util.Collection<T>
Specified by:
size in interface java.util.Set<T>
Specified by:
size in class java.util.AbstractCollection<T>

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection<T>
Specified by:
toArray in interface java.util.Set<T>
Overrides:
toArray in class java.util.AbstractCollection<T>

toArray

public java.lang.Object[] toArray(java.lang.Object[] arr)
Specified by:
toArray in interface java.util.Collection<T>
Specified by:
toArray in interface java.util.Set<T>
Overrides:
toArray in class java.util.AbstractCollection<T>