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

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

There is a newer version: 2.1.5
Show newest version
package net.dongliu.commons.lang.collection;

/**
 * pair with members key and value.
 * 

* {@code Pair pair = Pair.of("test", 1);} *

* * @author Dong Liu */ public class Pair { private K key; private V value; public static Pair of(S key, T value) { Pair pair = new Pair<>(); pair.setKey(key); pair.setValue(value); 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