org.biojava.utils
Class SmallSet
java.lang.Object
java.util.AbstractCollection
java.util.AbstractSet
org.biojava.utils.SmallSet
- All Implemented Interfaces:
- Iterable, Collection, Set
public class SmallSet
- extends 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
SmallSet
public SmallSet()
SmallSet
public SmallSet(int size)
SmallSet
public SmallSet(Collection col)
contains
public boolean contains(Object o)
- Specified by:
contains in interface Collection- Specified by:
contains in interface Set- Overrides:
contains in class AbstractCollection
size
public int size()
- Specified by:
size in interface Collection- Specified by:
size in interface Set- Specified by:
size in class AbstractCollection
add
public boolean add(Object o)
- Specified by:
add in interface Collection- Specified by:
add in interface Set- Overrides:
add in class AbstractCollection
iterator
public Iterator iterator()
- Specified by:
iterator in interface Iterable- Specified by:
iterator in interface Collection- Specified by:
iterator in interface Set- Specified by:
iterator in class AbstractCollection