nl.knowledgeplaza.util
Class LinearSet<T>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<T>
          extended by nl.knowledgeplaza.util.LinearSet<T>
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<T>, java.util.Collection<T>, java.util.Set<T>

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

LinearSet is a simplistic light-weight Set designed for use when the number of entries is small. It is backed by a List.

Version:
$Revision: 1.2 $
Author:
$Author: toeukpap $
See Also:
Serialized Form

Constructor Summary
LinearSet()
          Creates a LinearSet.
LinearSet(java.util.Collection collection)
          Creates a LinearSet, filling it with the elements of set.
LinearSet(int capacity)
          Creates a LinearSet with given capacity.
 
Method Summary
 boolean add(int pos, T o)
           
 boolean add(T o)
           
 boolean addAll(java.util.Collection<? extends T> c)
           
 java.lang.Object clone()
           
 T get(int pos)
           
 java.util.Iterator<T> iterator()
           
 boolean remove(java.lang.Object o)
           
 int size()
           
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
clear, contains, containsAll, isEmpty, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
clear, contains, containsAll, isEmpty, retainAll, toArray, toArray
 

Constructor Detail

LinearSet

public LinearSet()
Creates a LinearSet. Uses an ArrayList as the backing store.


LinearSet

public LinearSet(int capacity)
Creates a LinearSet with given capacity. Uses an ArrayList as the backing store.


LinearSet

public LinearSet(java.util.Collection collection)
Creates a LinearSet, filling it with the elements of set. Uses an ArrayList as the backing store.

Method Detail

add

public boolean add(int pos,
                   T o)

add

public boolean add(T 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>

addAll

public boolean addAll(java.util.Collection<? extends T> c)
Specified by:
addAll in interface java.util.Collection<T>
Specified by:
addAll in interface java.util.Set<T>
Overrides:
addAll in class java.util.AbstractCollection<T>

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

get

public T get(int pos)

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>


Copyright © 2010. All Rights Reserved.