Sunday, August 7, 2011

Pair (Generics)


package com.evs.objava33.class12;

public class Pair<KeyType, ValueType> {

private KeyType key;
private ValueType value;

public Pair(KeyType key, ValueType value) {
this.key = key;
this.value = value;
}

/**
* @return the key
*/
public KeyType getKey() {
return key;
}

/**
* @param key
*            the key to set
*/
public void setKey(KeyType key) {
this.key = key;
}

/**
* @return the value
*/
public ValueType getValue() {
return value;
}

/**
* @param value
*            the value to set
*/
public void setValue(ValueType value) {
this.value = value;
}

public String toString() {
return "Pair [key=" + key + ", value=" + value + "]";
}
}

No comments:

Post a Comment