GuavaCacheBasedBiPredicateMemoizer extends AbstractGuavaCacheBasedMemoizer<KEY, Boolean> implements BiPredicate<FIRST, SECOND> { @Override public boolean test(final FIRST first, final SECOND second) { final KEY key = keyFunction.apply(first, second); return get(key, givenKey -> Boolean.valueOf(biPredicate.test(first, second))).booleanValue(); } GuavaCacheBasedBiPredicateMemoizer(
            final Cache<KEY, Boolean> cache,
            final BiFunction<FIRST, SECOND, KEY> keyFunction,
            final BiPredicate<FIRST, SECOND> biPredicate); @Override boolean test(final FIRST first, final SECOND second);  }
@Test public void shouldTransformInput() { final BiPredicate<String, String> biFunction = (first, second) -> true; final BiFunction<String, String, String> keyFunction = (first, second) -> second + first; final Cache<String, Boolean> cache = CacheBuilder.newBuilder().build(); final GuavaCacheBasedBiPredicateMemoizer<String, String, String> memoizer = new GuavaCacheBasedBiPredicateMemoizer<>( cache, keyFunction, biFunction); Assert.assertTrue(memoizer.test("first", "second")); }