Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class KeyValuePair<K extends Comparable<K>, V> implements Comparable<KeyValuePair<K, V>> {
- public KeyValuePair(K key, V value) {
- super();
- this.key = key;
- this.value = value;
- }
- private K key;
- private V value;
- public V getValue() {
- return value;
- }
- public void setValue(V value) {
- this.value = value;
- }
- public K getKey() {
- return key;
- }
- @Override
- public String toString() {
- return "KeyValuePair [key=" + key + ", value=" + value + "]";
- }
- @Override
- public int compareTo(KeyValuePair<K, V> o) {
- return key.compareTo(o.getKey());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement