org.biojava.utils
Class SmallSet
java.lang.Object
|
+--java.util.AbstractCollection
|
+--java.util.AbstractSet
|
+--org.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
|
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.Set set)
contains
public boolean contains(java.lang.Object o)
- 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.Set- Specified by:
size in class java.util.AbstractCollection
add
public boolean add(java.lang.Object o)
- 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.util.Set- Specified by:
iterator in class java.util.AbstractCollection