@Override public Observable<FilterResult<Id>> call( final Observable<FilterResult<Id>> filterResultObservable ) { //filter only the first id, then map into our path for our next pass //skip our first and emit if neccessary return filterResultObservable.skipWhile( filterResult -> { final Optional<Id> startFromCursor = getSeekValue(); return startFromCursor.isPresent() && startFromCursor.get().equals( filterResult.getValue() ); } ); }
@Override public Observable<FilterResult<Entity>> call( final Observable<FilterResult<Entity>> filterResultObservable ) { //filter only the first id, then map into our path for our next pass return filterResultObservable.skipWhile( filterResult -> { final Optional<Id> startFromCursor = getSeekValue(); return startFromCursor.isPresent() && startFromCursor.get().equals( filterResult.getValue().getId() ); } ).map( filterResult -> { final Entity entity = filterResult.getValue(); final Id entityId = entity.getId(); return createFilterResult( entity, entityId, filterResult.getPath() ); } ); }
/** * Generate an observable for our appliation scope */ private Observable<ApplicationScope> getApplications( final Optional<EdgeScope> cursor, final Optional<ApplicationScope> appId ) { //cursor is present use it and skip until we hit that app if (cursor.isPresent()) { final EdgeScope cursorValue = cursor.get(); //we have a cursor and an application scope that was used. return allApplicationsObservable.getData().skipWhile( applicationScope -> !cursorValue.getApplicationScope().equals(applicationScope)); } //this is intentional. If else if (appId.isPresent()) { return Observable.just(appId.get()) .doOnNext(appScope -> { //make sure index is initialized on rebuild entityIndexFactory.createEntityIndex( indexLocationStrategyFactory.getIndexLocationStrategy(appScope) ).initialize(); }); } return allApplicationsObservable.getData() .doOnNext(appScope -> { //make sure index is initialized on rebuild entityIndexFactory.createEntityIndex( indexLocationStrategyFactory.getIndexLocationStrategy(appScope) ).initialize(); }); }
@Override public Observable<FilterResult<ConnectionRef>> call( final Observable<FilterResult<ConnectionRef>> filterResultObservable ) { //filter only the first id, then map into our path for our next pass return filterResultObservable.skipWhile( filterResult -> { final Optional<Id> startFromCursor = getSeekValue(); if ( !startFromCursor.isPresent() ) { return false; } final ConnectedEntityRef ref = filterResult.getValue().getTargetRefs(); final Id entityId = startFromCursor.get(); return entityId.getUuid().equals( ref.getUuid() ) && entityId.getType().equals( ref.getType() ); } ).map( filterResult -> { final ConnectionRef entity = filterResult.getValue(); final String type = entity.getTargetRefs().getType(); final UUID uuid = entity.getTargetRefs().getUuid(); final Id entityId = new SimpleId( uuid, type ); return createFilterResult( entity, entityId, filterResult.getPath() ); } ); }
.skipWhile( uniqueValue -> {
@Override public void run() { Observable.range(1, 10).skipWhile(new Func1<Integer, Boolean>() { @Override public Boolean call(Integer i) { return i < 3; } }).subscribe(new Action1<Integer>() { @Override public void call(Integer integer) { log(integer); } }); } });
Observable<LocalDate> nextSolarEclipse(LocalDate after) { return Observable .just( LocalDate.of(2016, MARCH, 9), LocalDate.of(2016, SEPTEMBER, 1), LocalDate.of(2017, FEBRUARY, 26), LocalDate.of(2017, AUGUST, 21), LocalDate.of(2018, FEBRUARY, 15), LocalDate.of(2018, JULY, 13), LocalDate.of(2018, AUGUST, 11), LocalDate.of(2019, JANUARY, 6), LocalDate.of(2019, JULY, 2), LocalDate.of(2019, DECEMBER, 26)) .skipWhile(date -> !date.isAfter(after)) .zipWith( Observable.interval(500, 50, MILLISECONDS), (date, x) -> date); }
.skipWhile(new Func1<ObserveItem, Boolean>() { @Override public Boolean call(ObserveItem status) {
.skipWhile(new Func1<ObserveItem, Boolean>() { @Override public Boolean call(ObserveItem status) {
.skipWhile(new Func1<ObserveItem, Boolean>() { @Override public Boolean call(ObserveItem status) {
.skipWhile(new Func1<ObserveItem, Boolean>() { @Override public Boolean call(ObserveItem status) {