JCacheBasedDoubleSupplierMemoizer extends AbstractJCacheBasedMemoizer<KEY, Double> implements DoubleSupplier { @Override public double getAsDouble() { return invoke(keySupplier.get(), key -> Double.valueOf(supplier.getAsDouble())).doubleValue(); } JCacheBasedDoubleSupplierMemoizer(
            final Cache<KEY, Double> cache,
            final Supplier<KEY> keySupplier,
            final DoubleSupplier supplier); @Override double getAsDouble();  }
@Test public void shouldMemoizeSupplier() { final DoubleSupplier supplier = () -> 123.456D; final Supplier<String> keySupplier = () -> "key"; try (final Cache<String, Double> cache = JCacheMemoize.createCache(Supplier.class)) { final JCacheBasedDoubleSupplierMemoizer<String> loader = new JCacheBasedDoubleSupplierMemoizer<>(cache, keySupplier, supplier); Assert.assertEquals("Memoized value does not match expectation", 123.456D, loader.getAsDouble(), 0.0D); } }