Skip to content

Instantly share code, notes, and snippets.

View cap5lut's full-sized avatar

Florian Pattke cap5lut

  • Berlin
View GitHub Profile
@cap5lut
cap5lut / Lazy.java
Last active January 10, 2019 14:07
Lazy instatiation, which will work lock-free once the instance is created.
package com.github.cap5lut.util;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Supplier;
/**
* Lazy instance creation.
* @param <T> Instance type.
*/