org.limewire.collection
Class Pair
java.lang.Object
org.limewire.collection.Pair
- All Implemented Interfaces:
- Comparable<Pair>
public class Pair
- extends Object
- implements Comparable<Pair>
Contains an int property key and its corresponding value type Object.
Pair p1 = new Pair(0, "Abby");
System.out.println("Compare Abby to Bob: " + p1.compareTo(new Pair(10, "Bob")));
System.out.println("Get element p1: " + p1.getElement());
Output:
Compare Abby to Bob: -10
Get element p1: Abby
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Pair
public Pair(int key,
Object elem)
getKey
public int getKey()
getElement
public Object getElement()
setKey
public void setKey(int key)
setElement
public void setElement(Object elem)
compareTo
public int compareTo(Pair p)
- Specified by:
compareTo in interface Comparable<Pair>
Copyright © 2008 Lime Wire LLC. All Rights Reserved.