Skip to content

Instantly share code, notes, and snippets.

@mboes
Created November 16, 2016 21:13
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
import java.util.*;
import java.util.stream.*;
class A {
public static void main(String args[]) {
long start, finish;
start = System.nanoTime();
//List<Integer> result = Stream.iterate(1, n -> n + 1)
//.limit(10000000)
long x = LongStream.range(0, 10000000000L)
.map(Math::incrementExact)
.sum();
finish = System.nanoTime();
System.out.println(x);
System.out.println((finish - start)/1000);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment