Skip to content

Instantly share code, notes, and snippets.

@yenerm
Created June 16, 2020 18:54
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 yenerm/e93cfa632286f5f66f20ddf0c0370986 to your computer and use it in GitHub Desktop.
Save yenerm/e93cfa632286f5f66f20ddf0c0370986 to your computer and use it in GitHub Desktop.
Stream Sample
<!-- Copyright 2019 Google LLC.
SPDX-License-Identifier: Apache-2.0 -->
List<person> list = Arrays.asList(personArray);
Stream<Person> stream1 = list.stream();
//or
Stream<Person> stream2 = Stream.of(personArray);
//or
Stream.Builder<Person> streamBuilder = Stream.builder();
for (Person p: personArray){
streamBuilder.accept(p);
}
Stream<Person> stream3 = streamBuilder.build();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment