com.aol.cyclops.streams.operators.SkipWhileTimeOperator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cyclops-streams Show documentation
Show all versions of cyclops-streams Show documentation
Sequential Streams and Stream Utilities for Java 8
package com.aol.cyclops.streams.operators;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
import java.util.stream.Stream;
import lombok.Value;
import com.aol.cyclops.sequence.SequenceM;
import com.aol.cyclops.streams.StreamUtils;
@Value
public class SkipWhileTimeOperator {
Stream stream;
public Stream skipWhile(long time, TimeUnit unit){
long start = System.nanoTime();
long allowed = unit.toNanos(time);
return stream.filter(a-> System.nanoTime()-start > allowed);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy