org.onebusaway.utility.collections
Class Indexed<T>

java.lang.Object
  extended by org.onebusaway.utility.collections.Indexed<T>
Type Parameters:
T -
All Implemented Interfaces:
Serializable, Comparable<Indexed<T>>

public class Indexed<T>
extends Object
implements Comparable<Indexed<T>>, Serializable

A wrapper class for an object that add an integer index parameter that can be used to apply a Comparable sort order to an arbitrary type.

Author:
bdferris
See Also:
Serialized Form

Constructor Summary
Indexed(T value, int index)
           
 
Method Summary
 int compareTo(Indexed<T> o)
           
static
<TO> Indexed<TO>
create(TO value, int index)
           
 boolean equals(Object obj)
           
 int getIndex()
           
 T getValue()
           
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Indexed

public Indexed(T value,
               int index)
Method Detail

create

public static <TO> Indexed<TO> create(TO value,
                                      int index)

getValue

public T getValue()

getIndex

public int getIndex()

compareTo

public int compareTo(Indexed<T> o)
Specified by:
compareTo in interface Comparable<Indexed<T>>

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011 OneBusAway. All Rights Reserved.