create changelog entry
[debian/openrocket] / core / src / net / sf / openrocket / util / ComparablePair.java
1 package net.sf.openrocket.util;
2
3 /**
4  * Sortable storage of a pair of objects.  A list of these objects can be sorted according
5  * to the first object.
6  * 
7  * @author Sampo Niskanen <sampo.niskanen@iki.fi>
8  * @param <U>   the first object type, according to which comparisons are performed.
9  * @param <V>   the second object type.
10  */
11 public class ComparablePair<U extends Comparable<U>, V> extends Pair<U, V> 
12         implements Comparable<ComparablePair<U, V>>{
13
14         public ComparablePair(U u, V v) {
15                 super(u, v);
16         }
17         
18         
19         /**
20          * Compares the first objects.  If either of the objects is <code>null</code> this
21          * method throws <code>NullPointerException</code>.
22          */
23         @Override
24         public int compareTo(ComparablePair<U, V> other) {
25                 return this.getU().compareTo(other.getU());
26         }
27
28 }