MemoizedFileSystemsSupplier implements Supplier<T> { @Override public T get() { T t = this.map.computeIfAbsent(MemoizedFileSystemsSupplier.class, k -> this.delegate.get()); return t; } private  MemoizedFileSystemsSupplier(Supplier<T> delegate); @Override T get(); static Supplier<T> of(Supplier<T> provider);  }
@Test public void supplierTest() { getSupplier().get(); getSupplier().get(); assertEquals(2, instanceCount); instanceCount = 0; final Supplier<DummyObject> supplier = getLazySupplier(); supplier.get(); supplier.get(); supplier.get(); supplier.get(); assertEquals(1, instanceCount); }