ResultSets { public static List<ListenableFuture<ResultSet>> queryAll(Session session, String query, Object... partitionKeys) { List<ResultSetFuture> futures = sendQueries(session, query, partitionKeys); return Futures.inCompletionOrder(futures); }  static Future<List<ResultSet>> queryAllAsList(Session session, String query, Object... partitionKeys); static List<ListenableFuture<ResultSet>> queryAll(Session session, String query, Object... partitionKeys); static Observable<ResultSet> queryAllAsObservable(Session session, String query, Object... partitionKeys);  }
@Test public void should_query_partitions_with_futures_in_order() throws Exception { List<ListenableFuture<ResultSet>> futures = ResultSets.queryAll(session, "SELECT * FROM users WHERE id = ?", uuids); List<String> names = Lists.newArrayList(); for (ListenableFuture<ResultSet> future : futures) { ResultSet rs = future.get(100, MILLISECONDS); names.add(rs.one().getString("name")); } Assertions.assertThat(names).containsOnly("user1", "user2", "user3", "user4", "user5"); }