LimeWire collection component api

org.limewire.collection
Class SortedList<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by org.limewire.collection.TreeList<E>
              extended by org.limewire.collection.SortedList<E>
All Implemented Interfaces:
Iterable<E>, Collection<E>, List<E>
Direct Known Subclasses:
FixedSizeSortedList

public class SortedList<E>
extends TreeList<E>

Extends TreeList to sort elements upon insertion.

    SortedList<String> sl = new SortedList<String>();
    sl.add("Bob");
    sl.add("Chris");
    sl.add("Dan");
    sl.add("Abby");
    sl.add("Bob");
    System.out.println("Last element: " + sl.last());   
    System.out.println(sl); 

    Output:
        Last element: Dan
        [Abby, Bob, Bob, Chris, Dan]

 


Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
SortedList()
           
SortedList(Collection<? extends E> c)
           
SortedList(Collection<? extends E> c, Comparator<? super E> comparator)
           
SortedList(Comparator<? super E> comparator)
           
 
Method Summary
 boolean add(E e)
           
 Comparator<? super E> comparator()
           
 E first()
           
 E last()
           
 
Methods inherited from class org.limewire.collection.TreeList
add, clear, contains, get, indexOf, iterator, listIterator, listIterator, remove, remove, set, size, toArray
 
Methods inherited from class java.util.AbstractList
addAll, equals, hashCode, lastIndexOf, removeRange, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, isEmpty, removeAll, retainAll, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
addAll, containsAll, isEmpty, removeAll, retainAll, toArray
 

Constructor Detail

SortedList

public SortedList()

SortedList

public SortedList(Comparator<? super E> comparator)

SortedList

public SortedList(Collection<? extends E> c)

SortedList

public SortedList(Collection<? extends E> c,
                  Comparator<? super E> comparator)
Method Detail

add

public boolean add(E e)
Specified by:
add in interface Collection<E>
Specified by:
add in interface List<E>
Overrides:
add in class AbstractList<E>

first

public E first()

last

public E last()

comparator

public Comparator<? super E> comparator()

LimeWire collection component api

Copyright © 2009 Lime Wire LLC. All Rights Reserved.