Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.stream.LongStream;
- /**
- *
- * @author Ferrybig
- */
- public class TimeMilies {
- public final static boolean USE_SLEEPING_THREAD = true;
- public final static boolean USE_DISTINCT = true;
- public static void main(String... args) {
- if (USE_SLEEPING_THREAD) {
- Thread t = new Thread(() -> {
- try {
- Thread.sleep(Long.MAX_VALUE);
- } catch (InterruptedException ex) {
- Thread.currentThread().interrupt();
- }
- });
- t.setDaemon(true);
- t.start();
- }
- LongStream s = LongStream.generate(System::currentTimeMillis);
- if (USE_DISTINCT) {
- s = s.distinct();
- }
- s.limit(50).forEach(System.out::println);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment