source: java/ecj/cecj/utils/Pair.java @ 108

Last change on this file since 108 was 48, checked in by mszubert, 15 years ago

Debug parameter added.

File size: 670 bytes
RevLine 
[44]1/*
2  Copyright 2009 by Marcin Szubert
3  Licensed under the Academic Free License version 3.0
4 */
5
6package cecj.utils;
7
8public 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) {
[48]19                if (!(obj instanceof Pair<?>)) {
[44]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.