/** * Generically hold a key, value pair * @author gtowell * Created: Jul 2021 */ public class KeyValue { /** The key */ private final U key; /** the value */ private final V value; /** * Create a key, value pair * @param key the Key * @param value the value */ public KeyValue(U key, V value) { this.key = key; this.value = value; } public U getKey() { return key; } public V getValue() { return value; } @Override public String toString() { return "<" + key + ", " + value + ">"; } public static void main(String[] args) { KeyValue ksvi = new KeyValue<>("key", 1); KeyValue kdvsb = new KeyValue<>(3.1415, new StringBuffer("Now is the time")); System.out.println(ksvi); System.out.println(kdvsb); } }