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

collections.Pair Maven / Gradle / Ivy

There is a newer version: 1.6.9
Show newest version
package collections;

/**
 * A record that represents a pair of two values in different types.
 *
 * @param  the type of the first value in the pair
 * @param  the type of the second value in the pair
 */
public record Pair(A alpha, B beta){

    /**
     * Creates a new Pair object with the provided elements.
     *
     * @param alpha the first element of the pair.
     * @param beta  the second element of the pair.
     * @param    the type of the first element.
     * @param    the type of the second element.
     * @return a new Pair object containing the provided elements.
     */
    public static  Pair of(A alpha, B beta){
        return new Pair<>(alpha, beta);
    }
}