org.rx.bean.Tuple Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rxlib Show documentation
Show all versions of rxlib Show documentation
A set of utilities for Java
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);
}
}