Skip to content

Instantly share code, notes, and snippets.

@yyYank
Created September 19, 2015 02:09
Show Gist options
  • Save yyYank/9f8cee6d3b59dcc5c9bf to your computer and use it in GitHub Desktop.
Save yyYank/9f8cee6d3b59dcc5c9bf to your computer and use it in GitHub Desktop.
むずかしい
fun main(args : Array<String>) {
// JavaのFunctoinのSAMはこんな感じな気がする
val func = java.util.function.Function<Int, Int>{ a -> a + 1}
val result = func.apply(1)
println(result)
// こんなんも微妙
val res = FuncExecutor("hogehoge").execute{
a -> "hogehogehogeohoge"
}
}
// 微妙なクラス
class FuncExecutor(val a : String) {
fun execute (f : (a : String) -> String) {
java.util.function.Function<String, String>{
f(a)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment