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

de.team33.patterns.tuple.janus.Pair Maven / Gradle / Ivy

There is a newer version: 1.20.0
Show newest version
package de.team33.patterns.tuple.janus;

import java.util.Arrays;
import java.util.List;

public class Pair extends Tuple {

    private final L left;
    private final R right;

    public Pair(final L left, final R right) {
        this.left = left;
        this.right = right;
    }

    public static  Pair of(final L left, final R right) {
        return new Pair<>(left, right);
    }

    public final L left() {
        return left;
    }

    public final R right() {
        return right;
    }

    @Override
    public final List toList() {
        return Arrays.asList(left, right);
    }
}