-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKeyValuePair.java
More file actions
42 lines (37 loc) · 910 Bytes
/
Copy pathKeyValuePair.java
File metadata and controls
42 lines (37 loc) · 910 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package de.unistuttgart.dsass2025.ex10.p5;
/**
* Key-value-pairs are the entries in a hash map. The key is expected to be an integer and value is
* of generic type V.
*
* @param <V> the value type of the key-value-pairs in the hash map
*/
public final class KeyValuePair<V> {
private final int key;
private final V value;
/**
* Creates a new key value pair.
*
* @param key key for the key value pair; cannot be null
* @param value the value associated with the given key
*/
public KeyValuePair(int key, V value) {
this.key = key;
this.value = value;
}
/**
* Returns the key of the pair.
*
* @return the key
*/
public int getKey() {
return this.key;
}
/**
* Returns the value of the pair.
*
* @return the value
*/
public V getValue() {
return this.value;
}
}