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 akka.actor.{ Actor, Props } | |
class $NAME$ extends Actor { | |
override def receive = ??? | |
} | |
object $NAME$ { | |
def props: Props = Props(new $NAME$) | |
} |
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
public class Main { | |
@FunctionalInterface | |
interface Function3 <A, B, C, R> { | |
public R apply (A a, B b, C c); | |
} | |
public static void main(String[] args) { | |
BiFunction<Integer, Integer, Integer> add = Math::addExact; | |
BiFunction<Integer, Integer, Integer> subtract = Math::subtractExact; |
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
interface Empty<A> { | |
A empty(); | |
} |
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
class EmptyInt implements Empty<Integer>{ | |
@Override | |
public Integer empty() { | |
return 0; | |
} | |
} |
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
interface Empty<A> { | |
A empty(); | |
static Empty<Integer> emptyInt(){ | |
return new EmptyInt(); | |
} | |
} |
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
interface Empty<A> { | |
A empty(); | |
static Empty<Integer> emptyInt(){ | |
return () -> 0; | |
} | |
} |
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
final class Functions { | |
static <T> Tuple2<T, T> twoEmpties(Empty<T> empty) { | |
return Tuple.of(empty.empty(), empty.empty()); | |
} | |
... | |
} |
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
var xAndY = twoEmpties(emptyInt()); | |
System.out.println("{" + xAndY._1() + ", " + xAndY._2() + "}"); |
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
val xAndY = twoEmpties() |
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
interface Show<A> { | |
String show(A a); | |
static <X, Y> Show<Tuple2<X, Y>> showTuple() { | |
return t -> "{" + t._1() + ", " + t._2() + "}"; | |
} | |
} |
OlderNewer