@Test public void always_call_for_null() { final MemoidOne<Integer, Integer> memoid = new MemoidOne<>(new Function<Integer, Integer>() { private int invocation_count = 0; @Override public Integer apply(Integer i) { return ++invocation_count; } }); assertEquals(Integer.valueOf(1), memoid.apply(null)); assertEquals(Integer.valueOf(2), memoid.apply(null)); assertEquals(Integer.valueOf(3), memoid.apply(null)); assertEquals(Integer.valueOf(4), memoid.apply(null)); }
@Override public Output apply(Input input) { if (input == null) return fn_.apply(input); return match_(input) .orElseGet(() -> derive_(input)) .getOutput(); }
MemoidOne implements Function<Input, Output> { @Override public Output apply(Input input) { if (input == null) return fn_.apply(input); return match_(input) .orElseGet(() -> derive_(input)) .getOutput(); } }
MemoidOne implements Function<Input, Output> { @Override public Output apply(Input input) { if (input == null) return fn_.apply(input); return match_(input) .orElseGet(() -> derive_(input)) .getOutput(); } MemoidOne(Function<? super Input, ? extends Output> fn);  MemoidOne(Function<? super Input, ? extends Output> fn, BiPredicate<Input, Input> equality); }
MemoidOne implements Function<Input, Output> { @Override public Output apply(Input input) { if (input == null) return fn_.apply(input); return match_(input) .orElseGet(() -> derive_(input)) .getOutput(); } MemoidOne(Function<? super Input, ? extends Output> fn);  MemoidOne(Function<? super Input, ? extends Output> fn, BiPredicate<Input, Input> equality); @Override Output apply(Input input); }
MemoidOne implements Function<Input, Output> { @Override public Output apply(Input input) { if (input == null) return fn_.apply(input); return match_(input) .orElseGet(() -> derive_(input)) .getOutput(); } MemoidOne(Function<? super Input, ? extends Output> fn);  MemoidOne(Function<? super Input, ? extends Output> fn, BiPredicate<Input, Input> equality); @Override Output apply(Input input);  }