Created
October 8, 2020 22:11
-
-
Save RayStarkMC/73a77c5a744c484377f87b47d6146661 to your computer and use it in GitHub Desktop.
IDEAからのGistテスト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.jetbrains.annotations.NotNull; | |
import java.util.function.Function; | |
public interface Tuple2<T1, T2> { | |
@NotNull | |
T1 t1(); | |
@NotNull | |
T2 t2(); | |
@NotNull | |
default T1 left() { | |
return t1(); | |
} | |
@NotNull | |
default T2 right() { | |
return t2(); | |
} | |
<R1> Tuple2<R1, T2> mapT1(@NotNull Function<? super T1, ? extends R1> mapper); | |
<R2> Tuple2<T1, R2> mapT2(@NotNull Function<? super T2, ? extends R2> mapper); | |
static <T1, T2> Tuple2<T1, T2> of(T1 t1, T2 t2) { | |
return new ValueTuple2<>(t1, t2); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment