summaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/keuin/crosslink/util/Pair.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/main/java/com/keuin/crosslink/util/Pair.java b/src/main/java/com/keuin/crosslink/util/Pair.java
new file mode 100644
index 0000000..c59c816
--- /dev/null
+++ b/src/main/java/com/keuin/crosslink/util/Pair.java
@@ -0,0 +1,42 @@
+package com.keuin.crosslink.util;
+
+import java.util.Objects;
+
+public class Pair<K, V> {
+ private final K k;
+ private final V v;
+
+ public Pair(K k, V v) {
+ this.k = k;
+ this.v = v;
+ }
+
+ public K getK() {
+ return k;
+ }
+
+ public V getV() {
+ return v;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ Pair<?, ?> pair = (Pair<?, ?>) o;
+ return Objects.equals(k, pair.k) && Objects.equals(v, pair.v);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(k, v);
+ }
+
+ @Override
+ public String toString() {
+ return "Pair{" +
+ "k=" + k +
+ ", v=" + v +
+ '}';
+ }
+}