All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sfm.tuples.Tuple3 Maven / Gradle / Ivy

Go to download

Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.

There is a newer version: 1.10.3
Show newest version
package org.sfm.tuples;

public class Tuple3 extends Tuple2 {

    private final T3 element2;

    public Tuple3(T1 element0, T2 element1, T3 element2) {
        super(element0, element1);
        this.element2 = element2;
    }

    public final T3 getElement2() {
        return element2;
    }

    public final T3 third() {
        return getElement2();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;

        Tuple3 tuple3 = (Tuple3) o;

        if (element2 != null ? !element2.equals(tuple3.element2) : tuple3.element2 != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = super.hashCode();
        result = 31 * result + (element2 != null ? element2.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "Tuple3{" +
                "element0=" + getElement0() +
                ", element1=" + getElement1() +
                ", element2=" + getElement2() +
                '}';
    }

    public  Tuple4 tuple4(T4 element3) {
        return new Tuple4(getElement0(), getElement1(), getElement2(), element3);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy