Last change
on this file since 35 was
28,
checked in by mszubert, 16 years ago
|
cecj - coEvolutionary Computation in Java with additional games package
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Id Revision
|
File size:
560 bytes
|
Line | |
---|
1 | package cecj.utils; |
---|
2 | |
---|
3 | public class Pair<T> { |
---|
4 | public T first; |
---|
5 | public T second; |
---|
6 | |
---|
7 | public Pair(T first, T second) { |
---|
8 | this.first = first; |
---|
9 | this.second = second; |
---|
10 | } |
---|
11 | |
---|
12 | @Override |
---|
13 | public boolean equals(Object obj) { |
---|
14 | if (!(obj instanceof Pair)) { |
---|
15 | return false; |
---|
16 | } |
---|
17 | |
---|
18 | Pair<?> other = (Pair<?>) obj; |
---|
19 | return (first.equals(other.first) && second.equals(other.second)); |
---|
20 | } |
---|
21 | |
---|
22 | @Override |
---|
23 | public int hashCode() { |
---|
24 | return first.hashCode() + second.hashCode(); |
---|
25 | } |
---|
26 | |
---|
27 | public String toString() { |
---|
28 | return "<" + first.toString() + ", " + second.toString() + ">"; |
---|
29 | } |
---|
30 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.