Package com.graphaware.common.util
Class ComparableItem<T,C extends Comparable<C>>
- java.lang.Object
-
- com.graphaware.common.util.ComparableItem<T,C>
-
- Type Parameters:
T
- type of the item.C
- type of the quantity associated with the item.
- All Implemented Interfaces:
Comparable<ComparableItem<T,C>>
public class ComparableItem<T,C extends Comparable<C>> extends Object implements Comparable<ComparableItem<T,C>>
A comparable item. Note that equality and hash code depend purely in the item, not on the quantity associated with it.
-
-
Constructor Summary
Constructors Constructor Description ComparableItem(T item, C quantity)
Construct a new comparable item.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(ComparableItem<T,C> o)
boolean
equals(Object o)
T
getItem()
C
getQuantity()
int
hashCode()
-
-
-
Method Detail
-
getItem
public T getItem()
-
getQuantity
public C getQuantity()
-
compareTo
public int compareTo(ComparableItem<T,C> o)
- Specified by:
compareTo
in interfaceComparable<T>
-
-