JCacheBasedIntSupplierMemoizer extends AbstractJCacheBasedMemoizer<KEY, Integer> implements IntSupplier { @Override public int getAsInt() { return invoke(keySupplier.get(), key -> Integer.valueOf(supplier.getAsInt())).intValue(); } JCacheBasedIntSupplierMemoizer(
            final Cache<KEY, Integer> cache,
            final Supplier<KEY> keySupplier,
            final IntSupplier supplier); @Override int getAsInt();  }
@Test public void shouldMemoizeSupplier() { final IntSupplier supplier = () -> 123; final Supplier<String> keySupplier = () -> "key"; try (final Cache<String, Integer> cache = JCacheMemoize.createCache(Supplier.class)) { final JCacheBasedIntSupplierMemoizer<String> loader = new JCacheBasedIntSupplierMemoizer<>(cache, keySupplier, supplier); Assert.assertEquals("Memoized value does not match expectation", 123, loader.getAsInt()); } }