/** Returns a future containing the results of {@code a} and {@code b} if both futures complete * successfully, or a {@link MultiFailureException} aggregating all failures, if either of the * futures fails. */ public static <A,B> RFuture<T2<A,B>> sequence (RFuture<A> a, RFuture<B> b) { @SuppressWarnings("unchecked") RFuture<Object> oa = (RFuture<Object>)a; @SuppressWarnings("unchecked") RFuture<Object> ob = (RFuture<Object>)b; return sequence(Arrays.asList(oa, ob)).map(new Function<List<Object>,T2<A,B>>() { public T2<A,B> apply (List<Object> results) { @SuppressWarnings("unchecked") A a = (A)results.get(0); @SuppressWarnings("unchecked") B b = (B)results.get(1); return new T2<A,B>(a, b); } }); }
/** Returns a future containing the results of {@code a} and {@code b} if both futures complete * successfully, or a {@link MultiFailureException} aggregating all failures, if either of the * futures fails. */ public static <A,B> RFuture<T2<A,B>> sequence (RFuture<A> a, RFuture<B> b) { @SuppressWarnings("unchecked") RFuture<Object> oa = (RFuture<Object>)a; @SuppressWarnings("unchecked") RFuture<Object> ob = (RFuture<Object>)b; return sequence(Arrays.asList(oa, ob)).map(new Function<List<Object>,T2<A,B>>() { public T2<A,B> apply (List<Object> results) { @SuppressWarnings("unchecked") A a = (A)results.get(0); @SuppressWarnings("unchecked") B b = (B)results.get(1); return new T2<A,B>(a, b); } }); }
/** Returns a future containing the results of {@code a}, {@code b}, and {@code c} if all * futures complete successfully, or a {@link MultiFailureException} aggregating all failures, * if any of the futures fails. */ public static <A,B,C> RFuture<T3<A,B,C>> sequence (RFuture<A> a, RFuture<B> b, RFuture<C> c) { @SuppressWarnings("unchecked") RFuture<Object> oa = (RFuture<Object>)a; @SuppressWarnings("unchecked") RFuture<Object> ob = (RFuture<Object>)b; @SuppressWarnings("unchecked") RFuture<Object> oc = (RFuture<Object>)c; return sequence(Arrays.asList(oa, ob, oc)).map(new Function<List<Object>,T3<A,B,C>>() { public T3<A,B,C> apply (List<Object> results) { @SuppressWarnings("unchecked") A a = (A)results.get(0); @SuppressWarnings("unchecked") B b = (B)results.get(1); @SuppressWarnings("unchecked") C c = (C)results.get(2); return new T3<A,B,C>(a, b, c); } }); }
/** Returns a future containing the results of {@code a}, {@code b}, and {@code c} if all * futures complete successfully, or a {@link MultiFailureException} aggregating all failures, * if any of the futures fails. */ public static <A,B,C> RFuture<T3<A,B,C>> sequence (RFuture<A> a, RFuture<B> b, RFuture<C> c) { @SuppressWarnings("unchecked") RFuture<Object> oa = (RFuture<Object>)a; @SuppressWarnings("unchecked") RFuture<Object> ob = (RFuture<Object>)b; @SuppressWarnings("unchecked") RFuture<Object> oc = (RFuture<Object>)c; return sequence(Arrays.asList(oa, ob, oc)).map(new Function<List<Object>,T3<A,B,C>>() { public T3<A,B,C> apply (List<Object> results) { @SuppressWarnings("unchecked") A a = (A)results.get(0); @SuppressWarnings("unchecked") B b = (B)results.get(1); @SuppressWarnings("unchecked") C c = (C)results.get(2); return new T3<A,B,C>(a, b, c); } }); }
RFuture.sequence(atlasImages).onSuccess(new Slot<List<Image>>() { public void onEmit (List<Image> atlases) { result.succeed(new Library(frameRate, movies, textures));
return RFuture.sequence(atlasImages).map(new Function<List<Image>,Library>() { public Library apply (List<Image> atlases) { return new Library(frameRate, movies, textures);