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