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

com.clumd.projects.java_common_utils.models.Pair Maven / Gradle / Ivy

There is a newer version: 4.1.1
Show newest version
package com.clumd.projects.java_common_utils.models;

import lombok.Data;

import java.io.Serializable;

/**
 * A simple 'Pair' concept, which groups together two objects, via whatever logical grouping the user believes.
 */
@Data
public class Pair implements Serializable {

    private L left;
    private R right;

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

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

    public L getFirst() {
        return left;
    }

    public void setFirst(final L updatedFirst) {
        left = updatedFirst;
    }

    public R getSecond() {
        return right;
    }

    public void setSecond(final R updatedSecond) {
        right = updatedSecond;
    }

    @Override
    public String toString() {
        return "< " + left.toString() + " : " + right.toString() + " >";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy