data-structures/java/Dictionary/KVpair.java
2022-09-15 18:44:24 +05:30

24 lines
323 B
Java

/** Container class for a key-value pair */
class KVpair<Key, E> {
private Key k;
private E e;
/** Constructors */
KVpair() {
k = null;
e = null;
}
KVpair(Key kval, E eval) {
k = kval; e = eval;
}
/** Data member access functions */
public Key key() {
return k;
}
public E value() {
return e;
}
}