49 lines
1.1 KiB
Java
49 lines
1.1 KiB
Java
|
package bwapi;
|
||
|
|
||
|
/**
|
||
|
* Created with IntelliJ IDEA.
|
||
|
* User: Vladimir
|
||
|
* Date: 27.2.2014
|
||
|
* Time: 10:52
|
||
|
*/
|
||
|
public class Pair<K,V> {
|
||
|
public K first;
|
||
|
public V second;
|
||
|
|
||
|
public Pair() {
|
||
|
}
|
||
|
|
||
|
public Pair(K first, V second) {
|
||
|
this.first = first;
|
||
|
this.second = second;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public String toString() {
|
||
|
return "Pair{" +
|
||
|
"first=" + first +
|
||
|
", second=" + second +
|
||
|
'}';
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public boolean equals(Object o) {
|
||
|
if (this == o) return true;
|
||
|
if (o == null || getClass() != o.getClass()) return false;
|
||
|
|
||
|
Pair pair = (Pair) o;
|
||
|
|
||
|
if (first != null ? !first.equals(pair.first) : pair.first != null) return false;
|
||
|
if (second != null ? !second.equals(pair.second) : pair.second != null) return false;
|
||
|
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public int hashCode() {
|
||
|
int result = first != null ? first.hashCode() : 0;
|
||
|
result = 31 * result + (second != null ? second.hashCode() : 0);
|
||
|
return result;
|
||
|
}
|
||
|
}
|