aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/api/objects/data/FlexiblePair.java
blob: 698e56ae4525fe19233d348b805f9bc28f8de05d (plain)
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
package gtPlusPlus.api.objects.data;

import com.google.common.base.Objects;
import java.io.Serializable;

public class FlexiblePair<K, V> implements Serializable {

    /**
     * SVUID
     */
    private static final long serialVersionUID = 1250550491092812443L;

    private final K key;
    private V value;

    public FlexiblePair(final K key, final V value) {
        this.key = key;
        this.value = value;
    }

    public final K getKey() {
        return this.key;
    }

    public final V getValue() {
        return this.value;
    }

    public final void setValue(V aObj) {
        value = aObj;
    }

    @Override
    public int hashCode() {
        Integer aCode = Objects.hashCode(getKey(), getValue());
        return aCode != null ? aCode : super.hashCode();
    }
}