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

org.rx.bean.Tuple Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
package org.rx.bean;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.AbstractMap;
import java.util.Map;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Tuple implements Serializable {
    private static final long serialVersionUID = 5110049327430282262L;
    static final Tuple EMPTY = new Tuple<>();

    public static  Tuple empty() {
        return EMPTY;
    }

    public static  Tuple of(T1 t1, T2 t2) {
        return new Tuple<>(t1, t2);
    }

    public T1 left;
    public T2 right;

    public Map.Entry toMapEntry() {
        return new AbstractMap.SimpleImmutableEntry<>(left, right);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy