org.legendofdragoon.modloader.Latch Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mod-loader Show documentation
Show all versions of mod-loader Show documentation
The mod loader used by various Severed Chains projects
package org.legendofdragoon.modloader;
import java.util.function.Supplier;
public class Latch implements Supplier {
private final Supplier supplier;
private T value;
private boolean resolved;
public Latch(final Supplier supplier) {
this.supplier = supplier;
}
public void clear() {
this.value = null;
this.resolved = false;
}
@Override
public T get() {
if(!this.resolved) {
this.value = this.supplier.get();
this.resolved = true;
}
return this.value;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy