nl.knowledgeplaza.util
Class SortedSet

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet
          extended by nl.knowledgeplaza.util.SortedSet
All Implemented Interfaces:
Serializable, Cloneable, Iterable, Collection, Set

public class SortedSet
extends AbstractSet
implements Cloneable, Serializable

SortedSet is a simplistic light-weight Set designed for use when the number of entries is small. It is backed by a List. Unlike TreeSet it allows NULL to be added

Version:
$Revision: 1.2 $
Author:
$Author: toeukpap $
See Also:
Serialized Form

Constructor Summary
SortedSet()
          Creates a LinearSet.
SortedSet(Collection collection)
          Creates a LinearSet, filling it with the elements of set.
SortedSet(Comparator comparator)
          Creates a LinearSet.
SortedSet(int capacity)
          Creates a LinearSet with given capacity.
 
Method Summary
 boolean add(int pos, Object o)
           
 boolean add(Object o)
           
 boolean addAll(Collection c)
           
 Object clone()
           
 Object get(int pos)
           
 Iterator iterator()
           
 boolean remove(Object o)
           
 int size()
           
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
clear, contains, containsAll, isEmpty, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
clear, contains, containsAll, isEmpty, retainAll, toArray, toArray
 

Constructor Detail

SortedSet

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


SortedSet

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


SortedSet

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


SortedSet

public SortedSet(Collection collection)
Creates a LinearSet, filling it with the elements of set. Uses an ArrayList as the backing store.

Method Detail

add

public boolean add(int pos,
                   Object o)

add

public boolean add(Object o)
Specified by:
add in interface Collection
Specified by:
add in interface Set
Overrides:
add in class AbstractCollection

addAll

public boolean addAll(Collection c)
Specified by:
addAll in interface Collection
Specified by:
addAll in interface Set
Overrides:
addAll in class AbstractCollection

clone

public Object clone()
Overrides:
clone in class Object

get

public Object get(int pos)

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

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection
Specified by:
remove in interface Set
Overrides:
remove 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


Copyright © 2012 KnowledgePlaza. All Rights Reserved.