pick 97420a31d The big reformat of 2020
This commit is contained in:
@@ -18,27 +18,21 @@
|
||||
|
||||
package appeng.util;
|
||||
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class Lazy<T> implements Supplier<T> {
|
||||
private final Supplier<T> supplier;
|
||||
private T instance = null;
|
||||
|
||||
public class Lazy<T> implements Supplier<T>
|
||||
{
|
||||
private final Supplier<T> supplier;
|
||||
private T instance = null;
|
||||
public Lazy(final Supplier<T> supplier) {
|
||||
this.supplier = supplier;
|
||||
}
|
||||
|
||||
public Lazy( final Supplier<T> supplier )
|
||||
{
|
||||
this.supplier = supplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get()
|
||||
{
|
||||
if( this.instance == null )
|
||||
{
|
||||
this.instance = this.supplier.get();
|
||||
}
|
||||
return this.instance;
|
||||
}
|
||||
@Override
|
||||
public T get() {
|
||||
if (this.instance == null) {
|
||||
this.instance = this.supplier.get();
|
||||
}
|
||||
return this.instance;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user