LimeWire Collection Component API

org.limewire.collection
Class Pair

java.lang.Object
  extended by 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

 


Constructor Summary
Pair(int key, Object elem)
           
 
Method Summary
 int compareTo(Pair p)
           
 Object getElement()
           
 int getKey()
           
 void setElement(Object elem)
           
 void setKey(int key)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pair

public Pair(int key,
            Object elem)
Method Detail

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>

LimeWire Collection Component API

Copyright © 2008 Lime Wire LLC. All Rights Reserved.