Stream<T> peek​(Consumer<? super T> action)
This is an intermediate operation.
Stream<T> sorted()
statefull intermediate operation. sorted according to natural order. interface Comparable
<R,​A> R collect​(Collector<? super T,​A,​R> collector)
This is a terminal operation
D is correct because only ----- print first and when collect is called execeute peek 1 (list in order original , sort , and peek2 (list ordered by natural order)
D is correct because
Intermediate operations in a stream are lazy, meaning they are not evaluated until a terminal operation is invoked. The purpose of a terminal operation is to produce a result or perform a side effect.
Dis correct, until terminal operator is called the source won't generate streams.
upvoted 2 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
ASPushkin
4Â months, 2Â weeks agoASPushkin
2Â weeks, 6Â days agothanhbt
11Â months, 4Â weeks agod7bb0b2
1Â year agoStavok
1Â year, 7Â months agoMukes877
1Â year, 7Â months agoRP384
1Â year, 11Â months ago