Interface UncheckedSupplier<T>

  • Type Parameters:
    T - the type of items supplied by this supplier
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface UncheckedSupplier<T>
    Represents a supplier of items.

    The supplier can throw Exceptions.

    • Method Detail

      • from

        static <T> UncheckedSupplier<T> from​(java.util.function.Supplier<T> supplier)
        Creates a new UncheckedSupplier from an existing Supplier
        Type Parameters:
        T - the type of items supplied by this supplier
        Parameters:
        supplier - the supplier
        Returns:
        the new UncheckedSupplier
      • get

        T get()
        throws java.lang.Exception
        Gets an item.
        Returns:
        an item
        Throws:
        java.lang.Exception - if anything wrong happen
      • toSupplier

        default java.util.function.Supplier<T> toSupplier()
        Returns:
        the Supplier getting the item produced by this UncheckedSupplier. If an exception is thrown during the production, this exception is rethrown, wrapped into a RuntimeException if needed.