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:
Serializable, Cloneable, Iterable<T>, Collection<T>, Set<T>

public class LinearSet<T>
extends AbstractSet<T>
implements Cloneable, 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(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(Collection<? extends T> c)
           
 Object clone()
           
 T get(int pos)
           
 Iterator<T> iterator()
           
 boolean remove(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(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 Collection<T>
Specified by:
add in interface Set<T>
Overrides:
add in class AbstractCollection<T>

addAll

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

clone

public Object clone()
Overrides:
clone in class Object

get

public T get(int pos)

iterator

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

remove

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

size

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


Copyright © 2011 KnowledgePlaza. All Rights Reserved.