org.biojava.utils
Class SmallSet

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractSet
          extended byorg.biojava.utils.SmallSet
All Implemented Interfaces:
java.util.Collection, java.util.Set

public class SmallSet
extends java.util.AbstractSet

Lightweight implementation of Set which uses little memory to store a small number of items, at the expense of scalability. Not recomended for more than 20-30 items.

This implementation has the useful property that the iteration order is the same as the order in which the items are added.

Author:
Matthew Pocock

Constructor Summary
SmallSet()
           
SmallSet(int size)
           
SmallSet(java.util.Set set)
           
 
Method Summary
 boolean add(java.lang.Object o)
           
 boolean contains(java.lang.Object o)
           
 java.util.Iterator iterator()
           
 int size()
           
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, clear, containsAll, isEmpty, remove, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll, clear, containsAll, isEmpty, remove, retainAll, toArray, toArray
 

Constructor Detail

SmallSet

public SmallSet()

SmallSet

public SmallSet(int size)

SmallSet

public SmallSet(java.util.Set set)
Method Detail

contains

public boolean contains(java.lang.Object o)

size

public int size()

add

public boolean add(java.lang.Object o)

iterator

public java.util.Iterator iterator()