org.norther.tammi.acorn.util
Interface OrderedSet

All Superinterfaces:
Collection, Iterable, Set
All Known Implementing Classes:
ModifiableSet, OrderedHashSet, StringKeyHashSet, UnmodifiableSet

public interface OrderedSet
extends Set

An extension to Set maintaining the definition order of the elements of the set.

Author:
Ilkka Priha

Method Summary
 boolean add(int index, Object object)
          Adds the specified element to the specified index in this set.
 Object get(int index)
          Gets the indexed element in this set.
 int indexOf(Object object)
          Returns the index of the specified element, or -1 if not found.
 boolean isModifiable()
          Checks whether this set is modifiable.
 Iterator iterator()
          Returns an ordered iterator over the elements in this set.
 ListIterator listIterator()
          Returns a list iterator over the elements in this set.
 ListIterator listIterator(int index)
          Returns a list iterator with a start index over the elements in this set.
 Object remove(int index)
          Removes the indexed element in this set.
 List valueList()
          Returns an ordered list of set values.
 
Methods inherited from interface java.util.Set
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, size, toArray, toArray
 

Method Detail

isModifiable

boolean isModifiable()
Checks whether this set is modifiable.

Returns:
true for a modifiable set, false otherwise.

indexOf

int indexOf(Object object)
Returns the index of the specified element, or -1 if not found.

Parameters:
object - the element.
Returns:
the index of the element.

get

Object get(int index)
Gets the indexed element in this set.

Parameters:
index - the index.
Returns:
the indexed the element.
Throws:
IndexOutOfBoundsException - if the index is out of range.

add

boolean add(int index,
            Object object)
Adds the specified element to the specified index in this set. Note that an existing element is not moved.

Parameters:
index - the index.
object - the element.
Returns:
true if added, false if already present.
Throws:
IndexOutOfBoundsException - if the index is out of range.

remove

Object remove(int index)
Removes the indexed element in this set.

Parameters:
index - the index.
Returns:
the removed value.
Throws:
IndexOutOfBoundsException - if the index is out of range.

iterator

Iterator iterator()
Returns an ordered iterator over the elements in this set.

Specified by:
iterator in interface Collection
Specified by:
iterator in interface Iterable
Specified by:
iterator in interface Set
Returns:
an iterator.

listIterator

ListIterator listIterator()
Returns a list iterator over the elements in this set.

Returns:
a list iterator.

listIterator

ListIterator listIterator(int index)
Returns a list iterator with a start index over the elements in this set.

Parameters:
index - the start index.
Returns:
a list iterator.

valueList

List valueList()
Returns an ordered list of set values.

Returns:
a list of values.


Copyright © 2004 The Norther Organization. All rights reserved.