net.dongliu.commons.lang.Pair Maven / Gradle / Ivy
package net.dongliu.commons.lang;
/**
* pair
*
* @author Dong Liu
*/
public class Pair {
private K key;
private V value;
public static Pair of(S v1, T v2) {
Pair pair = new Pair<>();
pair.setKey(v1);
pair.setValue(v2);
return pair;
}
public K getKey() {
return key;
}
public void setKey(K key) {
this.key = key;
}
public V getValue() {
return value;
}
public void setValue(V value) {
this.value = value;
}
@Override
public String toString() {
return String.valueOf(key) + " -> " + String.valueOf(value);
}
}