GuavaCacheBasedObjDoubleConsumerMemoizer extends AbstractGuavaCacheBasedMemoizer<KEY, KEY> implements ObjDoubleConsumer<FIRST> { @Override public void accept(final FIRST first, final double value) { final KEY key = keyFunction.apply(first, value); get(key, givenKey -> { biConsumer.accept(first, value); return givenKey; }); } GuavaCacheBasedObjDoubleConsumerMemoizer(
            final Cache<KEY, KEY> cache,
            final ObjDoubleFunction<FIRST, KEY> keyFunction,
            final ObjDoubleConsumer<FIRST> biConsumer); @Override void accept(final FIRST first, final double value);  }
@Test @SuppressWarnings(CompilerWarnings.UNCHECKED) public void shouldAcceptInput() { final ObjDoubleConsumer<String> biConsumer = Mockito.mock(ObjDoubleConsumer.class); final ObjDoubleFunction<String, String> keyFunction = (first, second) -> second + first; final Cache<String, String> cache = CacheBuilder.newBuilder().build(); final GuavaCacheBasedObjDoubleConsumerMemoizer<String, String> memoizer = new GuavaCacheBasedObjDoubleConsumerMemoizer<>( cache, keyFunction, biConsumer); memoizer.accept("first", 123); Mockito.verify(biConsumer).accept("first", 123); }