35
33

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Java8 ラムダ式用のクラス

Last updated at Posted at 2014-03-19

背景

Java 8 が公開され、Javaでもラムダ式が使えるようになった。
言語的制約により、Javaはプリミティブ型を含むものは別のインタフェースを用意せざるを得なかった。

その結果、必要なクラス名が簡単にはわからなくなってしまったので、とりあえず列挙してみた。
規則性はあるようだが、命名規則の優先度がいまいちよく分からない

対象

対象は Runnableクラス, java.util.function名前空間のものである。

一覧表

ラムダ式の型 Javaのクラス + メソッド名
() -> void java.lang.Runnable.run
(T, U) -> void java.util.function.BiConsumer.accept
(T, U) -> R java.util.function.BiFunction.apply
(T, U) -> boolean java.util.function.BiPredicate.test
() -> boolean java.util.function.BooleanSupplier.getAsBoolean
T -> void java.util.function.Consumer.accept
(double, double) -> double java.util.function.DoubleBinaryOperator.applyAsDouble
double -> void java.util.function.DoubleConsumer.accept
double -> R java.util.function.DoubleFunction.apply
double -> boolean java.util.function.DoublePredicate.test
() -> double java.util.function.DoubleSupplier.getAsDouble
double -> int java.util.function.DoubleToIntFunction.applyAsInt
double -> long java.util.function.DoubleToLongFunction.applyAsLong
double -> double java.util.function.DoubleUnaryOperator.applyAsDouble
T -> R java.util.function.Function.apply
(int, int) -> int java.util.function.IntBinaryOperator.applyAsInt
int -> void java.util.function.IntConsumer.accept
int -> R java.util.function.IntFunction.apply
int -> boolean java.util.function.IntPredicate.test
() -> int java.util.function.IntSupplier.getAsInt
int -> double java.util.function.IntToDoubleFunction.applyAsDouble
int -> long java.util.function.IntToLongFunction.applyAsLong
int -> int java.util.function.IntUnaryOperator.applyAsInt
(long, long) -> long java.util.function.LongBinaryOperator.applyAsLong
long -> void java.util.function.LongConsumer.accept
long -> R java.util.function.LongFunction.apply
long -> boolean java.util.function.LongPredicate.test
() -> long java.util.function.LongSupplier.getAsLong
long -> double java.util.function.LongToDoubleFunction.applyAsDouble
long -> int java.util.function.LongToIntFunction.applyAsInt
long -> long java.util.function.LongUnaryOperator.applyAsLong
(T, double) -> void java.util.function.ObjDoubleConsumer.accept
(T, int) -> void java.util.function.ObjIntConsumer.accept
(T, long) -> void java.util.function.ObjLongConsumer.accept
T -> boolean java.util.function.Predicate.test
() -> T java.util.function.Supplier.get
(T, U) -> double java.util.function.ToDoubleBiFunction.applyAsDouble
T -> double java.util.function.ToDoubleFunction.applyAsDouble
(T, U) -> int java.util.function.ToIntBiFunction.applyAsInt
T -> int java.util.function.ToIntFunction.applyAsInt
(T, U) -> long java.util.function.ToLongBiFunction.applyAsLong
T -> long java.util.function.ToLongFunction.applyAsLong
T -> R java.util.function.Function.apply
35
33
7

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
35
33

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?