File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
swan-assist/src/main/java/de/fraunhofer/iem/swan/assist/util Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 11package de .fraunhofer .iem .swan .assist .util ;
22
3+ import java .util .Objects ;
4+
35public class Pair <T ,U > {
46 private final T key ;
57 private final U value ;
@@ -16,4 +18,31 @@ public T getKey() {
1618 public U getValue () {
1719 return this .value ;
1820 }
21+
22+ @ Override
23+ public boolean equals (Object obj ) {
24+ if (this == obj ) {
25+ return true ;
26+ }
27+
28+ if (obj == null || getClass () != obj .getClass ()) {
29+ return false ;
30+ }
31+
32+ Pair <?, ?> pair = (Pair <?, ?>) obj ;
33+
34+ if (!Objects .equals (key , pair .key )) {
35+ return false ;
36+ }
37+
38+ return Objects .equals (value , pair .value );
39+ }
40+
41+ @ Override
42+ public int hashCode () {
43+ int result = key != null ? key .hashCode () : 0 ;
44+ result = 31 * result + (value != null ? value .hashCode () : 0 );
45+ return result ;
46+ }
47+
1948}
You can’t perform that action at this time.
0 commit comments