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