source code formatting.
[utils] / support / general / src / main / java / org / wamblee / general / Pair.java
1 /*
2  * Copyright 2005 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.wamblee.general;
17
18
19 /**
20  * Represents a pair of objects. This is inspired on the C++ Standard Template
21  * Library pair template.
22  *
23  * @param <T>
24  *            Type of the first object.
25  * @param <U>
26  *            Type of the second object.
27  *
28  * @author Erik Brakkee
29  */
30 public class Pair<T, U> {
31     private T t;
32     private U u;
33
34     /**
35      * Constructs the pair.
36      *
37      * @param aT
38      *            First object.
39      * @param aU
40      *            Second object.
41      */
42     public Pair(T aT, U aU) {
43         t = aT;
44         u = aU;
45     }
46
47     /**
48      * Copies a pair.
49      *
50      * @param aPair
51      *            Pair to copy.
52      */
53     public Pair(Pair<T, U> aPair) {
54         t = aPair.t;
55         u = aPair.u;
56     }
57
58     /**
59      * Gets the first object of the pair.
60      *
61      * @return First object.
62      */
63     public T getFirst() {
64         return t;
65     }
66
67     /**
68      * Gets the second object of the pair.
69      *
70      * @return Second object.
71      */
72     public U getSecond() {
73         return u;
74     }
75 }