@Test public void map(@Mock Consumer1<String> release) { Managed<Nothing, Throwable, String> resource = Managed.from(ZIO.pure("hola"), release); ZIO<Nothing, Throwable, Integer> use = resource.map(String::toUpperCase).use(string -> ZIO.pure(string.length())); assertEquals(right(4), use.provide(nothing())); verify(release).accept("hola"); }
public <B> Managed<R, E, B> map(Function1<? super A, ? extends B> mapper) { return flatMap(a -> pure(ZIO.pure(mapper.apply(a)))); }
Managed implements ManagedOf<R, E, A> { public <B> Managed<R, E, B> map(Function1<? super A, ? extends B> mapper) { return flatMap(a -> pure(ZIO.pure(mapper.apply(a)))); } }
Managed implements ManagedOf<R, E, A> { public <B> Managed<R, E, B> map(Function1<? super A, ? extends B> mapper) { return flatMap(a -> pure(ZIO.pure(mapper.apply(a)))); } protected  Managed(ZIO<R, E, Tuple2<A, Consumer1<? super A>>> resource); }
Managed implements ManagedOf<R, E, A> { public <B> Managed<R, E, B> map(Function1<? super A, ? extends B> mapper) { return flatMap(a -> pure(ZIO.pure(mapper.apply(a)))); } protected  Managed(ZIO<R, E, Tuple2<A, Consumer1<? super A>>> resource); Managed<R, E, B> map(Function1<? super A, ? extends B> mapper); Managed<R, F, A> mapError(Function1<? super E, ? extends F> mapper); Managed<R, E, B> flatMap(Function1<? super A, ? extends Managed<R, E, ? extends B>> mapper); Managed<R, F, A> flatMapError(Function1<? super E, ? extends Managed<R, F, ? extends A>> mapper); Managed<R, E, B> andThen(Managed<A, E, B> other); ZIO<R, E, B> use(Function1<? super A, ? extends ZIO<R, E, ? extends B>> use); Managed<R, Nothing, B> fold(
      Function1<? super E, ? extends B> mapError, Function1<? super A, ? extends B> mapper); Managed<R, Nothing, A> recover(Function1<? super E, ? extends A> mapError); Managed<R, E, A> orElse(Managed<R, E, ? extends A> other); Managed<R, F, B> foldM(
      Function1<? super E, ? extends Managed<R, F, ? extends B>> mapError, 
      Function1<? super A, ? extends Managed<R, F, ? extends B>> mapper); Managed<R, E, Tuple2<A, B>> combine(Managed<R, E, B> other); Managed<R, E, Either<A, B>> either(Managed<R, E, B> other); Managed<R, E, A> retry(); Managed<R, E, A> retry(int maxRetries); Managed<R, E, A> retry(Duration delay); Managed<R, E, A> retry(Duration delay, int maxRetries); Managed<R, E, A> retry(Schedule<R, E, B> schedule); Managed<R, E, Tuple2<Duration, A>> timed(); static Managed<R, E, A> pure(A resource); static Managed<R, E, A> pure(ZIO<R, E, ? extends A> resource); static Managed<R, E, A> from(ZIO<R, E, ? extends A> resource); static Managed<R, E, A> from(ZIO<R, E, ? extends A> resource, Consumer1<? super A> release); static Managed<R, E, A> from(Function1<? super R, ? extends A> mapper); static Managed<R, E, A> from(Function1<? super R, ? extends A> mapper, Consumer1<? super A> release); static Managed<R, E, A> fromM(Function1<? super R, ? extends ZIO<R, E, ? extends A>> mapper); static Managed<R, E, A> fromM(
      Function1<? super R, ? extends ZIO<R, E, ? extends A>> mapper, Consumer1<? super A> release); }
Managed implements ManagedOf<R, E, A> { public <B> Managed<R, E, B> map(Function1<? super A, ? extends B> mapper) { return flatMap(a -> pure(ZIO.pure(mapper.apply(a)))); } protected  Managed(ZIO<R, E, Tuple2<A, Consumer1<? super A>>> resource); Managed<R, E, B> map(Function1<? super A, ? extends B> mapper); Managed<R, F, A> mapError(Function1<? super E, ? extends F> mapper); Managed<R, E, B> flatMap(Function1<? super A, ? extends Managed<R, E, ? extends B>> mapper); Managed<R, F, A> flatMapError(Function1<? super E, ? extends Managed<R, F, ? extends A>> mapper); Managed<R, E, B> andThen(Managed<A, E, B> other); ZIO<R, E, B> use(Function1<? super A, ? extends ZIO<R, E, ? extends B>> use); Managed<R, Nothing, B> fold(
      Function1<? super E, ? extends B> mapError, Function1<? super A, ? extends B> mapper); Managed<R, Nothing, A> recover(Function1<? super E, ? extends A> mapError); Managed<R, E, A> orElse(Managed<R, E, ? extends A> other); Managed<R, F, B> foldM(
      Function1<? super E, ? extends Managed<R, F, ? extends B>> mapError, 
      Function1<? super A, ? extends Managed<R, F, ? extends B>> mapper); Managed<R, E, Tuple2<A, B>> combine(Managed<R, E, B> other); Managed<R, E, Either<A, B>> either(Managed<R, E, B> other); Managed<R, E, A> retry(); Managed<R, E, A> retry(int maxRetries); Managed<R, E, A> retry(Duration delay); Managed<R, E, A> retry(Duration delay, int maxRetries); Managed<R, E, A> retry(Schedule<R, E, B> schedule); Managed<R, E, Tuple2<Duration, A>> timed(); static Managed<R, E, A> pure(A resource); static Managed<R, E, A> pure(ZIO<R, E, ? extends A> resource); static Managed<R, E, A> from(ZIO<R, E, ? extends A> resource); static Managed<R, E, A> from(ZIO<R, E, ? extends A> resource, Consumer1<? super A> release); static Managed<R, E, A> from(Function1<? super R, ? extends A> mapper); static Managed<R, E, A> from(Function1<? super R, ? extends A> mapper, Consumer1<? super A> release); static Managed<R, E, A> fromM(Function1<? super R, ? extends ZIO<R, E, ? extends A>> mapper); static Managed<R, E, A> fromM(
      Function1<? super R, ? extends ZIO<R, E, ? extends A>> mapper, Consumer1<? super A> release);  }