jaggregate
Class NaturallySortedCollection<E extends Comparable<? super E>>

java.lang.Object
  extended by jaggregate.AbstractCollection<E>
      extended by jaggregate.AbstractExtensibleCollection<E>
          extended by jaggregate.SortedCollection<E>
              extended by jaggregate.NaturallySortedCollection<E>
Type Parameters:
E - a restriction on the types of elements that may be included in the collection
All Implemented Interfaces:
Collection<E>, ContractibleSequence<E>, ExtensibleCollection<E>, ReadOnlySequence<E>, Serializable

public class NaturallySortedCollection<E extends Comparable<? super E>>
extends SortedCollection<E>

Represents a variable-sized collection of objects whose elements are ordered based on the natural ordering of its elements, as defined by the interface Comparable. Elements may be added, removed, or inserted, and can be accessed using external integer keys.

Version:
$Id: NaturallySortedCollection.java,v 1.2 2008/03/26 18:00:33 pholser Exp $
Author:
Paul Holser
See Also:
Serialized Form

Constructor Summary
NaturallySortedCollection()
          Creates an empty naturally sorted collection.
NaturallySortedCollection(Collection<? extends E> newElements)
          Creates a naturally sorted collection containing the elements from the given collection.
NaturallySortedCollection(E... newElements)
          Creates a naturally sorted collection containing the elements from the given array.
NaturallySortedCollection(Iterable<? extends E> newElements)
          Creates a naturally sorted collection containing the elements from the given iterable.
 
Method Summary
static
<T extends Comparable<? super T>>
NaturallySortedCollection<T>
emptyNaturallySortedCollection()
          Creates an empty naturally sorted collection.
static
<T extends Comparable<? super T>>
NaturallySortedCollection<T>
naturallySortedCollectionFrom(Collection<? extends T> newElements)
          Creates a naturally sorted collection containing the elements from the given collection.
static
<T extends Comparable<? super T>>
NaturallySortedCollection<T>
naturallySortedCollectionFrom(Iterable<? extends T> newElements)
          Creates a naturally sorted collection containing the elements from the given iterable.
static
<T extends Comparable<? super T>>
NaturallySortedCollection<T>
naturallySortedCollectionWith(T... newElements)
          Creates a naturally sorted collection containing the elements from the given array.
 
Methods inherited from class jaggregate.SortedCollection
add, after, at, before, collect, comparator, concat, copyRange, copyWith, copyWithout, doWithIndex, doWithOthers, emptySortedCollection, equals, findFirst, findLast, first, forEachDo, forEachInRangeDo, forEachInRangeDoWithIndex, forEachInReverseDo, hashCode, indexOf, indexOf, last, reject, remove, removeAt, removeFirst, removeIf, removeLast, retainIf, reverse, select, size, sortedCollectionFrom, sortedCollectionFrom, sortedCollectionWith, toSortedCollection, toString
 
Methods inherited from class jaggregate.AbstractExtensibleCollection
addAll, addAll, addAll, addAll, removeAll, removeAll, removeAll, removeAll, retainAll, retainAll, retainAll, retainAll
 
Methods inherited from class jaggregate.AbstractCollection
allSatisfy, anySatisfy, detect, includes, inject, isEmpty, occurrencesOf, rehash, toArray, toArray, toBag, toIdentityBag, toIdentitySet, toOrderedCollection, toSet, toSortedCollection
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jaggregate.Collection
allSatisfy, anySatisfy, detect, includes, inject, isEmpty, occurrencesOf, rehash, toArray, toArray, toBag, toIdentityBag, toIdentitySet, toOrderedCollection, toSet, toSortedCollection
 
Methods inherited from interface jaggregate.Collection
allSatisfy, anySatisfy, detect, includes, inject, isEmpty, occurrencesOf, rehash, toArray, toArray, toBag, toIdentityBag, toIdentitySet, toOrderedCollection, toSet, toSortedCollection
 

Constructor Detail

NaturallySortedCollection

public NaturallySortedCollection()
Creates an empty naturally sorted collection.


NaturallySortedCollection

public NaturallySortedCollection(Collection<? extends E> newElements)
Creates a naturally sorted collection containing the elements from the given collection.

Parameters:
newElements - the elements to add to the new collection
Throws:
NullPointerException - if newElements is null

NaturallySortedCollection

public NaturallySortedCollection(E... newElements)
Creates a naturally sorted collection containing the elements from the given array.

Parameters:
newElements - the elements to add to the new collection
Throws:
NullPointerException - if newElements is null

NaturallySortedCollection

public NaturallySortedCollection(Iterable<? extends E> newElements)
Creates a naturally sorted collection containing the elements from the given iterable.

Parameters:
newElements - the elements to add to the new collection
Throws:
NullPointerException - if newElements is null
Method Detail

emptyNaturallySortedCollection

public static <T extends Comparable<? super T>> NaturallySortedCollection<T> emptyNaturallySortedCollection()
Creates an empty naturally sorted collection.

Type Parameters:
T - the type of elements to add to the new sorted collection
Returns:
a new sorted collection

naturallySortedCollectionFrom

public static <T extends Comparable<? super T>> NaturallySortedCollection<T> naturallySortedCollectionFrom(Collection<? extends T> newElements)
Creates a naturally sorted collection containing the elements from the given collection.

Type Parameters:
T - the type of elements to add to the new sorted collection
Parameters:
newElements - the elements to add to the new collection
Returns:
a new sorted collection
Throws:
NullPointerException - if newElements is null

naturallySortedCollectionWith

public static <T extends Comparable<? super T>> NaturallySortedCollection<T> naturallySortedCollectionWith(T... newElements)
Creates a naturally sorted collection containing the elements from the given array.

Type Parameters:
T - the type of elements to add to the new sorted collection
Parameters:
newElements - the elements to add to the new collection
Returns:
a new sorted collection
Throws:
NullPointerException - if newElements is null

naturallySortedCollectionFrom

public static <T extends Comparable<? super T>> NaturallySortedCollection<T> naturallySortedCollectionFrom(Iterable<? extends T> newElements)
Creates a naturally sorted collection containing the elements from the given iterable.

Type Parameters:
T - the type of elements to add to the new sorted collection
Parameters:
newElements - the elements to add to the new collection
Returns:
a new sorted collection
Throws:
NullPointerException - if newElements is null


© Copyright 2004-2008 Paul R. Holser, Jr. All rights reserved. Licensed under the Academic Free License version 3.0. pholser@alumni.rice.edu