org.jopendocument.util.Tuple3 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jOpenDocument Show documentation
Show all versions of jOpenDocument Show documentation
jOpenDocument is a free library for developers looking to use
Open Document files without OpenOffice.org.
The newest version!
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2008-2013 jOpenDocument, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU
* General Public License Version 3 only ("GPL").
* You may not use this file except in compliance with the License.
* You can obtain a copy of the License at http://www.gnu.org/licenses/gpl-3.0.html
* See the License for the specific language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each file.
*
*/
package org.jopendocument.util;
import java.util.Arrays;
import java.util.List;
/**
* A simple class to hold 3 values in a type-safe manner.
*
* @author Sylvain
*
* @param type of first value.
* @param type of second value.
* @param type of third value.
*/
public class Tuple3 extends Tuple2 {
public static final class List3 extends Tuple3 {
public List3(A a1, A a2, A a3) {
super(a1, a2, a3);
}
@SuppressWarnings("unchecked")
public List asList() {
return Arrays.asList(get0(), get1(), get2());
}
}
// just to make the code shorter
public static final Tuple3 create(A a, B b, C c) {
return new Tuple3(a, b, c);
}
private final C c;
public Tuple3(A a, B b, C c) {
super(a, b);
this.c = c;
}
public final C get2() {
return this.c;
}
@Override
public List asList() {
return Arrays.asList(get0(), get1(), get2());
}
}