Skip to content

Instantly share code, notes, and snippets.

@ohdoking
Created January 3, 2019 09:33
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 ohdoking/da4af7238f0945cdf6087dbc95505656 to your computer and use it in GitHub Desktop.
Save ohdoking/da4af7238f0945cdf6087dbc95505656 to your computer and use it in GitHub Desktop.
[Java]Reverse method in Stream
public static <T> Collector<T, ?, Stream<T>> reverse() {
return Collectors.collectingAndThen(Collectors.toList(), list -> {
Collections.reverse(list);
return list.stream();
});
}
@ohdoking
Copy link
Author

ohdoking commented Jan 3, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment