diff options
| author | EVE <EVE@EVE-PC> | 2017-03-13 16:42:21 -0400 |
|---|---|---|
| committer | EVE <EVE@EVE-PC> | 2017-03-13 16:42:21 -0400 |
| commit | 27bf571d6413c3cc6a5d664b5bddd38d21d7b1cd (patch) | |
| tree | 847fb52acb091c1c613d37b8477094d5762c6988 /BJC-Utils2/src/main/java/bjc/utils/data/SingleSupplier.java | |
| parent | aa807a96cae2c47259fb38f710640883060339e9 (diff) | |
Formatting
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/data/SingleSupplier.java')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/data/SingleSupplier.java | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/data/SingleSupplier.java b/BJC-Utils2/src/main/java/bjc/utils/data/SingleSupplier.java index b5ff1e3..bf8b0a0 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/data/SingleSupplier.java +++ b/BJC-Utils2/src/main/java/bjc/utils/data/SingleSupplier.java @@ -5,31 +5,30 @@ import java.util.function.Supplier; /** * A supplier that can only supply one value. * - * Attempting to retrieve another value will cause an exception to be - * thrown. + * Attempting to retrieve another value will cause an exception to be thrown. * * @author ben * * @param <T> */ public class SingleSupplier<T> implements Supplier<T> { - private static long nextID = 0; + private static long nextID = 0; - private Supplier<T> source; + private Supplier<T> source; - private boolean gotten; + private boolean gotten; - private long id; + private long id; // This is bad practice, but I want to know where the single // instantiation was, in case of duplicate initiations - private Exception instSite; + private Exception instSite; /** * Create a new single supplier from an existing value * * @param supp - * The supplier to give a single value from + * The supplier to give a single value from */ public SingleSupplier(Supplier<T> supp) { source = supp; @@ -42,10 +41,8 @@ public class SingleSupplier<T> implements Supplier<T> { @Override public T get() { if (gotten == true) { - IllegalStateException isex = new IllegalStateException( - "Attempted to get value more than once" - + " from single supplier #" + id - + ". Previous instantiation below."); + IllegalStateException isex = new IllegalStateException("Attempted to get value more than once" + + " from single supplier #" + id + ". Previous instantiation below."); isex.initCause(instSite); |
