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

com.jongsoft.lang.collection.tuple.Tuple Maven / Gradle / Ivy

The newest version!
package com.jongsoft.lang.collection.tuple;

import com.jongsoft.lang.collection.List;

public interface Tuple {

    interface Pair extends Tuple {
        X getFirst();
        Y getSecond();

        static  Pair of(X left, Y right) {
            return new PairImpl<>(left, right);
        }
    }

    interface Triplet extends Pair {
        Z getThird();

        static  Triplet of(X first, Y second, Z third) {
            return new TripletImpl<>(first, second, third);
        }
    }

    interface Quadruplet extends Triplet {
        D getFourth();

        static  Quadruplet of(X first, Y second, Z third, D fourth) {
            return new QuadrupletImpl<>(first, second, third, fourth);
        }
    }

    /**
     * Build an immutable {@link List} of all elements present in the {@link Tuple}.
     *
     * @return  the immutable {@link List} of the elements
     */
    List toList();

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy