org.almendra.commons.util.collection
Class SortedList

java.lang.Object
  extended by org.almendra.commons.util.collection.SortedList
All Implemented Interfaces:
java.lang.Iterable, java.util.Collection

public class SortedList
extends java.lang.Object
implements java.util.Collection


Field Summary
protected  java.util.Comparator comparator
           
protected  java.util.List sortedList
           
 
Constructor Summary
SortedList()
          Creates a new SortedList object.
SortedList(java.util.Collection c)
          Creates a new SortedList object.
SortedList(java.util.Collection c, java.util.Comparator comparator)
          Creates a new SortedList object.
SortedList(java.util.Comparator comparator)
          Creates a new SortedList object.
SortedList(SortedList l)
          Creates a new SortedList object.
SortedList(SortedList l, java.util.Comparator comparator)
          Creates a new SortedList object.
 
Method Summary
 boolean add(java.lang.Comparable c)
           
 boolean add(java.lang.Object o)
           
 boolean addAll(java.util.Collection c)
           
 boolean addAll(SortedList l)
           
 void clear()
           
 java.util.Comparator comparator()
           
 boolean contains(java.lang.Object o)
           
 boolean containsAll(java.util.Collection c)
           
 boolean equals(java.lang.Object obj)
           
 java.lang.Object first()
           
 java.lang.Object get(int index)
           
 int hashCode()
           
 SortedList headSet(java.lang.Object toElement)
           
 int indexOf(java.lang.Object o)
           
 boolean isEmpty()
           
 java.util.Iterator iterator()
           
 java.lang.Object last()
           
 int lastIndexOf(java.lang.Object o)
           
 java.util.ListIterator listIterator()
           
 java.util.ListIterator listIterator(int index)
           
 java.lang.Object remove(int index)
           
 boolean remove(java.lang.Object o)
           
 boolean removeAll(java.util.Collection c)
           
 boolean retainAll(java.util.Collection c)
           
 int size()
           
 java.util.List subList(int fromIndex, int toIndex)
           
 SortedList subSet(java.lang.Object fromElement, java.lang.Object toElement)
           
 SortedList tailSet(java.lang.Object fromElement)
           
 java.lang.Object[] toArray()
           
 java.lang.Object[] toArray(java.lang.Object[] a)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
addAll, containsAll, removeAll, retainAll, toArray
 

Field Detail

sortedList

protected java.util.List sortedList

comparator

protected java.util.Comparator comparator
Constructor Detail

SortedList

public SortedList()
Creates a new SortedList object.


SortedList

public SortedList(java.util.Comparator comparator)
Creates a new SortedList object.


SortedList

public SortedList(java.util.Collection c)
Creates a new SortedList object.


SortedList

public SortedList(SortedList l)
Creates a new SortedList object.


SortedList

public SortedList(SortedList l,
                  java.util.Comparator comparator)
Creates a new SortedList object.


SortedList

public SortedList(java.util.Collection c,
                  java.util.Comparator comparator)
Creates a new SortedList object.

Method Detail

add

public boolean add(java.lang.Comparable c)
Specified by:
add in interface java.util.Collection
Parameters:
o -
Returns:

addAll

public boolean addAll(SortedList l)
Parameters:
c -
Returns:

clear

public void clear()
Specified by:
clear in interface java.util.Collection

contains

public boolean contains(java.lang.Object o)
Specified by:
contains in interface java.util.Collection
Parameters:
o -
Returns:

containsAll

public boolean containsAll(java.util.Collection c)
Parameters:
c -
Returns:

equals

public boolean equals(java.lang.Object obj)
Specified by:
equals in interface java.util.Collection
Overrides:
equals in class java.lang.Object

get

public java.lang.Object get(int index)
Parameters:
index -
Returns:

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Collection
Overrides:
hashCode in class java.lang.Object

indexOf

public int indexOf(java.lang.Object o)
Parameters:
o -
Returns:

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection
Returns:

iterator

public java.util.Iterator iterator()
Specified by:
iterator in interface java.lang.Iterable
Specified by:
iterator in interface java.util.Collection
Returns:

lastIndexOf

public int lastIndexOf(java.lang.Object o)
Parameters:
o -
Returns:

listIterator

public java.util.ListIterator listIterator()
Returns:

listIterator

public java.util.ListIterator listIterator(int index)
Parameters:
index -
Returns:

remove

public java.lang.Object remove(int index)
Parameters:
index -
Returns:

remove

public boolean remove(java.lang.Object o)
Specified by:
remove in interface java.util.Collection
Parameters:
o -
Returns:

removeAll

public boolean removeAll(java.util.Collection c)
Parameters:
c -
Returns:

retainAll

public boolean retainAll(java.util.Collection c)
Parameters:
c -
Returns:

size

public int size()
Specified by:
size in interface java.util.Collection
Returns:

subList

public java.util.List subList(int fromIndex,
                              int toIndex)
Parameters:
fromIndex -
toIndex -
Returns:

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection
Returns:

toArray

public java.lang.Object[] toArray(java.lang.Object[] a)
Parameters:
a -
Returns:

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

first

public java.lang.Object first()
                       throws java.util.NoSuchElementException
Throws:
java.util.NoSuchElementException

last

public java.lang.Object last()
                      throws java.util.NoSuchElementException
Throws:
java.util.NoSuchElementException

comparator

public java.util.Comparator comparator()

headSet

public SortedList headSet(java.lang.Object toElement)
                   throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

tailSet

public SortedList tailSet(java.lang.Object fromElement)

subSet

public SortedList subSet(java.lang.Object fromElement,
                         java.lang.Object toElement)

addAll

public boolean addAll(java.util.Collection c)

add

public boolean add(java.lang.Object o)
Specified by:
add in interface java.util.Collection