net.israfil.foundation.collections
Class ArraySet<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
net.israfil.foundation.collections.ArraySet<E>
- All Implemented Interfaces:
- java.lang.Iterable<E>, java.util.Collection<E>, java.util.Set<E>
@Copyright(years={"2003","2004","2005","2006"},
owner="Israfil Consulting Services Corporation",
license="BSD")
public class ArraySet<E>- extends java.util.AbstractSet<E>
An ArrayList backed Set implementation, whose primary purpose is
to provide a Set that maintains the order of elements based on
indexes and/or the order in which items are added. Most
particularly it's to guarrantee deterministic results of an
iterator, where the iterator provides each element in the order
of the underlying list.
Note that the current implementation is limited, insofar as you
cannot get arraylist-like behaviour from it such as inserting.
You can add, and it's a bit like a stack-set, actually.
TODO: Consider making this a SortedSet, using the list order as the guarrantee. Not sure if it's a legit use of the API.
- Author:
- Christian Edward Gruber
| Methods inherited from class java.util.AbstractSet |
equals, hashCode, removeAll |
| Methods inherited from class java.util.AbstractCollection |
addAll, clear, contains, containsAll, isEmpty, 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, contains, containsAll, isEmpty, retainAll, toArray, toArray |
ArraySet
public ArraySet()
ArraySet
public ArraySet(int initialCapacity)
ArraySet
public ArraySet(java.util.Collection<E> col)
iterator
public java.util.Iterator<E> iterator()
- Specified by:
iterator in interface java.lang.Iterable<E>- Specified by:
iterator in interface java.util.Collection<E>- Specified by:
iterator in interface java.util.Set<E>- Specified by:
iterator in class java.util.AbstractCollection<E>
size
public int size()
- Specified by:
size in interface java.util.Collection<E>- Specified by:
size in interface java.util.Set<E>- Specified by:
size in class java.util.AbstractCollection<E>
add
public boolean add(E o)
- Specified by:
add in interface java.util.Collection<E>- Specified by:
add in interface java.util.Set<E>- Overrides:
add in class java.util.AbstractCollection<E>
remove
public boolean remove(java.lang.Object o)
- Specified by:
remove in interface java.util.Collection<E>- Specified by:
remove in interface java.util.Set<E>- Overrides:
remove in class java.util.AbstractCollection<E>
Copyright © 2003-2006 null. All Rights Reserved.