Class Try.WithResources1<T1 extends java.lang.AutoCloseable>

  • Type Parameters:
    T1 - Type of the 1st resource.
    Enclosing interface:
    Try<T>

    public static final class Try.WithResources1<T1 extends java.lang.AutoCloseable>
    extends java.lang.Object
    A Try-with-resources builder that operates on one AutoCloseable resource.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <R> Try<R> of​(CheckedFunction1<? super T1,​? extends R> f)
      Wraps the result of a computation that may fail in a Try.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • t1Supplier

        private final CheckedFunction0<? extends T1 extends java.lang.AutoCloseable> t1Supplier
    • Constructor Detail

    • Method Detail

      • of

        public <R> Try<R> of​(CheckedFunction1<? super T1,​? extends R> f)
        Wraps the result of a computation that may fail in a Try.
        Type Parameters:
        R - Result type of the computation.
        Parameters:
        f - A computation that takes one AutoClosable resource.
        Returns:
        A new Try instance.