All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.dongliu.commons.lang.Pair Maven / Gradle / Ivy

There is a newer version: 1.0.9
Show newest version
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);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy