JCacheBasedBooleanSupplierMemoizer extends AbstractJCacheBasedMemoizer<KEY, Boolean> implements BooleanSupplier { @Override public boolean getAsBoolean() { return invoke(keySupplier.get(), key -> Boolean.valueOf(supplier.getAsBoolean())).booleanValue(); } JCacheBasedBooleanSupplierMemoizer(
            final Cache<KEY, Boolean> cache,
            final Supplier<KEY> keySupplier,
            final BooleanSupplier supplier); @Override boolean getAsBoolean();  }
@Test public void shouldMemoizeSupplier() { final BooleanSupplier supplier = () -> true; final Supplier<String> keySupplier = () -> "key"; try (final Cache<String, Boolean> cache = JCacheMemoize.createCache(Supplier.class)) { final JCacheBasedBooleanSupplierMemoizer<String> loader = new JCacheBasedBooleanSupplierMemoizer<>(cache, keySupplier, supplier); Assert.assertTrue("Memoized value does not match expectation", loader.getAsBoolean()); } }