@Test public void concat() { final int childCursorSize = 3; final List<Integer> expectedResults = Arrays.asList(0, 100, 200, 401, 201, 1, 2, 302, 102); final List<FirableCursor<Integer>> cursors = Arrays.asList( new FirableCursor<>(RecordCursor.fromList(Arrays.asList(0, 100, 200))), new FirableCursor<>(RecordCursor.fromList(Arrays.asList(401, 201, 1))), new FirableCursor<>(RecordCursor.fromList(Arrays.asList(2, 302, 102))) ); final RecordCursorIterator<Integer> cursor = UnorderedUnionCursor.create(functionsFromCursors(cursors), null, null).asIterator(); Iterator<Integer> expectedIterator = expectedResults.iterator(); for (FirableCursor<Integer> childCursor : cursors) { childCursor.fireAll(); for (int i = 0; i < childCursorSize; i++) { assertEquals((int)expectedIterator.next(), (int)cursor.next()); } assertThat(childCursor.getNext().hasNext(), is(false)); } assertThat(cursor.hasNext(), is(false)); assertThat(cursor.getNoNextReason().isSourceExhausted(), is(true)); }
@Nonnull public static <T> UnorderedUnionCursor<T> create( @Nonnull List<Function<byte[], RecordCursor<T>>> cursorFunctions, @Nullable byte[] continuation, @Nullable FDBStoreTimer timer) { return new UnorderedUnionCursor<>(createCursorStates(cursorFunctions, continuation), timer); }
UnorderedUnionCursor extends UnionCursorBase<T, MergeCursorState<T>> { @Nonnull public static <T> UnorderedUnionCursor<T> create( @Nonnull List<Function<byte[], RecordCursor<T>>> cursorFunctions, @Nullable byte[] continuation, @Nullable FDBStoreTimer timer) { return new UnorderedUnionCursor<>(createCursorStates(cursorFunctions, continuation), timer); } }
UnorderedUnionCursor extends UnionCursorBase<T, MergeCursorState<T>> { @Nonnull public static <T> UnorderedUnionCursor<T> create( @Nonnull List<Function<byte[], RecordCursor<T>>> cursorFunctions, @Nullable byte[] continuation, @Nullable FDBStoreTimer timer) { return new UnorderedUnionCursor<>(createCursorStates(cursorFunctions, continuation), timer); } protected  UnorderedUnionCursor(@Nonnull List<MergeCursorState<T>> cursorStates,
                                   @Nullable FDBStoreTimer timer); }
UnorderedUnionCursor extends UnionCursorBase<T, MergeCursorState<T>> { @Nonnull public static <T> UnorderedUnionCursor<T> create( @Nonnull List<Function<byte[], RecordCursor<T>>> cursorFunctions, @Nullable byte[] continuation, @Nullable FDBStoreTimer timer) { return new UnorderedUnionCursor<>(createCursorStates(cursorFunctions, continuation), timer); } protected  UnorderedUnionCursor(@Nonnull List<MergeCursorState<T>> cursorStates,
                                   @Nullable FDBStoreTimer timer); @Nonnull static UnorderedUnionCursor<T> create(
            @Nonnull List<Function<byte[], RecordCursor<T>>> cursorFunctions,
            @Nullable byte[] continuation,
            @Nullable FDBStoreTimer timer); }
UnorderedUnionCursor extends UnionCursorBase<T, MergeCursorState<T>> { @Nonnull public static <T> UnorderedUnionCursor<T> create( @Nonnull List<Function<byte[], RecordCursor<T>>> cursorFunctions, @Nullable byte[] continuation, @Nullable FDBStoreTimer timer) { return new UnorderedUnionCursor<>(createCursorStates(cursorFunctions, continuation), timer); } protected  UnorderedUnionCursor(@Nonnull List<MergeCursorState<T>> cursorStates,
                                   @Nullable FDBStoreTimer timer); @Nonnull static UnorderedUnionCursor<T> create(
            @Nonnull List<Function<byte[], RecordCursor<T>>> cursorFunctions,
            @Nullable byte[] continuation,
            @Nullable FDBStoreTimer timer);  }