Return a new DStream containing only the elements that satisfy predicate.
8070
def filter(self, f):
        
        def func(iterator):
            return filter(f, iterator)
        return self.mapPartitions(func, True)
432844
def some(predicate, *seqs):
    
    try:
        if len(seqs) == 1: return ifilter(bool,imap(predicate, seqs[0])).next()
        else:             return ifilter(bool,starmap(predicate, izip(*seqs))).next()
    except StopIteration: return False
28151
@Override
   public CacheStream<R> filter(Predicate<? super R> predicate) {
      return addIntermediateOperation(new FilterOperation<>(predicate));
   }
292461
@CheckResult
    @NonNull
    public final Data<T> filter(@NonNull Predicate<? super T> predicate) {
        return new FilterData<>(this, predicate);
    }
231945
public final static <T> Tuple2<Stream<T>, Stream<T>> partition(final Stream<T> stream, final Predicate<? super T> splitter) {
        final Tuple2<Stream<T>, Stream<T>> Tuple2 = duplicate(stream);
        return Tuple.tuple(
                          Tuple2._1().filter(splitter), Tuple2._2().filter(splitter.negate()));
    }
1097984
public static <T> Predicate<T> contains(final Iterable<T> iterable) {
        return new Predicate<T>() {
            @Override
            public boolean test(final T testValue) {
                return Iterables.contains(iterable, testValue);
            }
        };
    }
1279077
public void getAllUpstreamElements( List<IHillSlope> elems, List<PfafstetterNumber> limit ) {
        // if the limit is the number of the actual element, return
        if (limit != null && limit.size() > 0) {
            for( PfafstetterNumber pfafs : limit ) {
                if (pfafs.compareTo(pfafstetterNumber) == 0) {
                    return;
                }
            }
        }
        elems.add(this);
        for( IHillSlope upstreamElement : upstreamElements ) {
            upstreamElement.getAllUpstreamElements(elems, limit);
        }
    }
109732
public static <K, V> List<V> removeAllIfByKey(Map<K, V> map,
            Predicate<? super K> filter) {
        return map.keySet().stream().filter(filter).collect(toList())
                .stream().map(map::remove).collect(toList());
    }
256506
public static Mapper filterMapper(final Predicate pred){
        return new Mapper(){
            public Object map(Object a) {
                return pred.evaluate(a) ? a : null;
            }
        };
    }
512101
def partition(predicate, iterable):
    

    t1, t2 = tee(iterable)

    return filterfalse(predicate, t1), filter(predicate, t2)
1063423
public static <K, V> Map<K, V> newFilteredMap(Map<K, V> map,
            Predicate<? super Entry<K, V>> filter) {
        return getEntryStreamWithFilter(map, filter)
                .collect(toMap(Entry::getKey, Entry::getValue));
    }
83566
def filter(pred: Callable, xs: Iterable):
    
    generator = (x for x in xs if pred(x))

    return gather(*generator)
927113
public static <T> Collector<T, ?, T> toOneElement() {
    return java.util.stream.Collectors.collectingAndThen(
      java.util.stream.Collectors.toList(),
      list -> {
        if (list.size() != 1) {
          throw new IllegalStateException("Stream should have only one element");
        }
        return list.get(0);
      });
  }
1312031
static IntStream stream(
        IntTuple tuple, int startInclusive, int endExclusive) 
    {
        IntTupleSpliterator intTupleSpliterator = 
            new IntTupleSpliterator(
                tuple, startInclusive, endExclusive);
        return StreamSupport.intStream(intTupleSpliterator, false);
    }
22864
def dimensionless_contents(streams, kdims, no_duplicates=True):
    
    names = stream_parameters(streams, no_duplicates)
    return [name for name in names if name not in kdims]
311723
@NotNull
    public static <T> Stream<T> of(@NotNull final T... elements) {
        Objects.requireNonNull(elements);
        if (elements.length == 0) {
            return Stream.<T>empty();
        }
        return new Stream<T>(new ObjArray<T>(elements));
    }
17013
public final static <T> Stream<Seq<T>> groupedWhile(final Stream<T> stream, final Predicate<? super T> predicate) {
        return StreamSupport.stream(new GroupedWhileSpliterator<>(stream.spliterator(),()->Seq.of(),Function.identity(),predicate.negate()),stream.isParallel());

    }