summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/util/Pair.java
blob: 7083bc3a37a545d18eb5da588b66ae9383ca1d3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package jrummikub.util;

/**
 * A pair of objects
 * 
 * @param <T1>
 *            Type of first component
 * @param <T2>
 *            Type of second component
 */
public class Pair<T1, T2> {
	private final T1 first;
	private final T2 second;

	/**
	 * Create a new pair from two values
	 * 
	 * @param first
	 *            the first pair component
	 * @param second
	 *            the second pair component
	 */
	public Pair(T1 first, T2 second) {
		this.first = first;
		this.second = second;
	}

	/**
	 * Extract the first component of a pair
	 * 
	 * @return the first pair component
	 */
	public T1 getFirst() {
		return first;
	}

	/**
	 * Extract the second component of a pair
	 * 
	 * @return the second pair component
	 */
	public T2 getSecond() {
		return second;
	}

}