fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.util.function.*;
  5. import java.lang.*;
  6. import java.io.*;
  7.  
  8. /* Name of the class has to be "Main" only if the class is public. */
  9. class Ideone
  10. {
  11. public static void main (String[] args) throws java.lang.Exception
  12. {
  13. System.out.println(new DialogueTree().head.req instanceof Serializable);
  14. }
  15.  
  16. private static class Player {}
  17. private static class NPC {}
  18.  
  19. public static class DialogueTree implements Serializable {
  20.  
  21. private Node head;
  22.  
  23. public DialogueTree() {
  24. head = new Node((BiPredicate<Player,NPC> & Serializable)(p,q) -> true);
  25. }
  26.  
  27. public DialogueTree add(int[] path, BiPredicate<Player,NPC> req) {
  28. head.children.add(new Node(req));
  29. return this;
  30. }
  31.  
  32. private static class Node implements Serializable {
  33. public List<Node> children;
  34. public BiPredicate<Player,NPC> req;
  35.  
  36. public Node(BiPredicate<Player,NPC> req) {
  37. this.req = req;
  38. }
  39. }
  40. }
  41. }
Success #stdin #stdout 0.1s 44012KB
stdin
Standard input is empty
stdout
true