diff options
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 | 16 |
1 files changed, 16 insertions, 0 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 f40ab29..ad00496 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/data/SingleSupplier.java +++ b/BJC-Utils2/src/main/java/bjc/utils/data/SingleSupplier.java @@ -2,6 +2,16 @@ package bjc.utils.data; 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. + * + * @author ben + * + * @param <T> + */ public class SingleSupplier<T> implements Supplier<T> { private static long nextID = 0; @@ -15,6 +25,12 @@ public class SingleSupplier<T> implements Supplier<T> { // instantiation was, in case of duplicate initiations private Exception instSite; + /** + * Create a new single supplier from an existing value + * + * @param supp + * The supplier to give a single value from + */ public SingleSupplier(Supplier<T> supp) { source = supp; |
