Skip to content

Instantly share code, notes, and snippets.

@mboes
Created November 16, 2016 21:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mboes/24810d495490eefbfe4740c2187316ea to your computer and use it in GitHub Desktop.
Save mboes/24810d495490eefbfe4740c2187316ea to your computer and use it in GitHub Desktop.
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