net.cscott.jutil

Class LinearSet<E>

public class LinearSet<E> extends AbstractSet<E> implements Cloneable, Serializable

LinearSet is a simplistic light-weight Set designed for use when the number of entries is small. It is backed by a List.

Version: $Id: LinearSet.java,v 1.3 2004/01/13 20:47:05 cananian Exp $

Author: Felix S. Klock II

Constructor Summary
LinearSet()
Creates a LinearSet.
LinearSet(int capacity)
Creates a LinearSet with given capacity.
LinearSet(Set<? extends E> set)
Creates a LinearSet, filling it with the elements of set.
LinearSet(Collection<? extends E> c)
Creates a LinearSet, filling it with the elements of the given collection.
LinearSet(ListFactory<E> lf)
Creates an empty LinearSet, using a List generated by lf as the backing store.
LinearSet(ListFactory<E> lf, int capacity)
Creates an empty LinearSet with a given capacity, using a List generated by lf as the backing store.
LinearSet(ListFactory<E> lf, Set<? extends E> set)
Creates an empty LinearSet, using a List generated by lf as the backing store, and fills it with the elements of set.
Method Summary
booleanadd(E o)
booleanaddAll(Collection<? extends E> c)
Objectclone()
Iterator<E>iterator()
booleanremove(Object o)
intsize()

Constructor Detail

LinearSet

public LinearSet()
Creates a LinearSet. Uses an ArrayList as the backing store.

LinearSet

public LinearSet(int capacity)
Creates a LinearSet with given capacity. Uses an ArrayList as the backing store.

LinearSet

public LinearSet(Set<? extends E> set)
Creates a LinearSet, filling it with the elements of set. Uses an ArrayList as the backing store.

LinearSet

public LinearSet(Collection<? extends E> c)
Creates a LinearSet, filling it with the elements of the given collection. Uses an ArrayList as the backing store. Uses time quadratic in the size of the given collection.

LinearSet

public LinearSet(ListFactory<E> lf)
Creates an empty LinearSet, using a List generated by lf as the backing store.

LinearSet

public LinearSet(ListFactory<E> lf, int capacity)
Creates an empty LinearSet with a given capacity, using a List generated by lf as the backing store.

LinearSet

public LinearSet(ListFactory<E> lf, Set<? extends E> set)
Creates an empty LinearSet, using a List generated by lf as the backing store, and fills it with the elements of set.

Method Detail

add

public boolean add(E o)

addAll

public boolean addAll(Collection<? extends E> c)

clone

public Object clone()

iterator

public Iterator<E> iterator()

remove

public boolean remove(Object o)

size

public int size()
Copyright © 2003 C. Scott Ananian