diff options
| author | Benjamin J. Culkin <bjculkin@mix.wvu.edu> | 2017-10-11 13:41:07 -0300 |
|---|---|---|
| committer | Benjamin J. Culkin <bjculkin@mix.wvu.edu> | 2017-10-11 13:41:07 -0300 |
| commit | 946cab444bc301d8a7c756a1bab039558288de89 (patch) | |
| tree | 419f27c39a509bcd83cae0e6630be8eb7ff95a30 /base/src/main/java/bjc/utils/data/SingleSupplier.java | |
| parent | c82e3b3b2de0633317ec8fc85925e91422820597 (diff) | |
Cleanup work
Diffstat (limited to 'base/src/main/java/bjc/utils/data/SingleSupplier.java')
| -rw-r--r-- | base/src/main/java/bjc/utils/data/SingleSupplier.java | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/base/src/main/java/bjc/utils/data/SingleSupplier.java b/base/src/main/java/bjc/utils/data/SingleSupplier.java index c675ebf..60f9136 100644 --- a/base/src/main/java/bjc/utils/data/SingleSupplier.java +++ b/base/src/main/java/bjc/utils/data/SingleSupplier.java @@ -10,28 +10,33 @@ import java.util.function.Supplier; * @author ben * * @param <T> - * The supplied type + * The supplied type */ public class SingleSupplier<T> implements Supplier<T> { + /* The next supplier ID. */ private static long nextID = 0; - + /* The supplier to yield from. */ private final Supplier<T> source; - + /* Whether this value has been retrieved yet. */ private boolean gotten; - + /* The ID of this supplier. */ private final long id; /* - * This is bad practice, but I want to know where the single - * instantiation was, in case of duplicate initiations. + * The place where the supplier was instantiated. + * + * @NOTE + * This is both slow to create, and generally bad practice to keep + * exceptions around without throwing them. However, it is very + * useful to find where the first instantiation was. */ private Exception instSite; /** - * Create a new single supplier from an existing value + * 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(final Supplier<T> supp) { source = supp; |
