Skip to content

Instantly share code, notes, and snippets.

@hendrysuwanda
Created September 15, 2017 08:59
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 hendrysuwanda/48cf8ec150d3ef4d44db0d2e38dec27c to your computer and use it in GitHub Desktop.
Save hendrysuwanda/48cf8ec150d3ef4d44db0d2e38dec27c to your computer and use it in GitHub Desktop.
How to using java's lambda expression to print an array
Arrays.stream(values).forEach(i -> System.out.println(Integer.toUnsignedString(i, 16)));
Arrays.stream(values)
.mapToObj(i -> Integer.toUnsignedString(i, 16))
.forEach(System.out::println);
String[] nums = {"three","two","one"};
Arrays.stream(nums).forEach(num -> System.out.println(num));
IntStream.of(values)
.mapToObj(i -> Integer.toUnsignedString(i, 16))
.forEach(System.out::println);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment