Last change
on this file since 521 was
193,
checked in by Maciej Komosinski, 11 years ago
|
Set svn:eol-style native for all textual files
|
-
Property svn:eol-style set to
native
|
File size:
670 bytes
|
Line | |
---|
1 | /* |
---|
2 | Copyright 2009 by Marcin Szubert |
---|
3 | Licensed under the Academic Free License version 3.0 |
---|
4 | */ |
---|
5 | |
---|
6 | package cecj.utils; |
---|
7 | |
---|
8 | public class Pair<T> { |
---|
9 | public T first; |
---|
10 | public T second; |
---|
11 | |
---|
12 | public Pair(T first, T second) { |
---|
13 | this.first = first; |
---|
14 | this.second = second; |
---|
15 | } |
---|
16 | |
---|
17 | @Override |
---|
18 | public boolean equals(Object obj) { |
---|
19 | if (!(obj instanceof Pair<?>)) { |
---|
20 | return false; |
---|
21 | } |
---|
22 | |
---|
23 | Pair<?> other = (Pair<?>) obj; |
---|
24 | return (first.equals(other.first) && second.equals(other.second)); |
---|
25 | } |
---|
26 | |
---|
27 | @Override |
---|
28 | public int hashCode() { |
---|
29 | return first.hashCode() + second.hashCode(); |
---|
30 | } |
---|
31 | |
---|
32 | @Override |
---|
33 | public String toString() { |
---|
34 | return "<" + first.toString() + ", " + second.toString() + ">"; |
---|
35 | } |
---|
36 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.