[New] Added new Tuple to collections

This commit is contained in:
Robert von Burg 2015-03-12 13:18:20 +01:00
parent 07f009b7ff
commit 638cebe01e
1 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,54 @@
/*
* Copyright 2013 Robert von Burg <eitch@eitchnet.ch>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.eitchnet.utils.collections;
/**
* Simple wrapper for two elements
*
* @author Robert von Burg <eitch@eitchnet.ch>
*/
public class Tuple {
private Object first;
private Object second;
public Tuple() {
//
}
public <T, U> Tuple(T first, U second) {
this.first = first;
this.second = second;
}
@SuppressWarnings("unchecked")
public <T> T getFirst() {
return (T) this.first;
}
public <T> void setFirst(T first) {
this.first = first;
}
@SuppressWarnings("unchecked")
public <U> U getSecond() {
return (U) this.second;
}
public <U> void setSecond(U second) {
this.second = second;
}
}