Starsector API
Loading...
Searching...
No Matches
Pair.java
Go to the documentation of this file.
1package com.fs.starfarer.api.util;
2
3
12public class Pair<A, B> {
13 public A one;
14 public B two;
15
16 public Pair() {}
17
18 public Pair(A one, B two) {
19 super();
20 this.one = one;
21 this.two = two;
22 }
23
25 public int hashCode() {
26 final int PRIME = 31;
27 int result = 1;
28 result = PRIME * result + ((one == null) ? 0 : one.hashCode());
29 result = PRIME * result + ((two == null) ? 0 : two.hashCode());
30 return result;
31 }
32 @SuppressWarnings("unchecked")
34 public boolean equals(Object obj) {
35 if (this == obj)
36 return true;
37 if (obj == null)
38 return false;
39 if (getClass() != obj.getClass())
40 return false;
41 final Pair other = (Pair) obj;
42 if (one == null) {
43 if (other.one != null)
44 return false;
45 } else if (!one.equals(other.one))
46 return false;
47 if (two == null) {
48 if (other.two != null)
49 return false;
50 } else if (!two.equals(other.two))
51 return false;
52 return true;
53 }
54}
boolean equals(Object obj)
Definition Pair.java:34