Which method is used to limit the number of elements in a stream?
Which method is used to limit the number of elements in a stream? a) limit() b) reduce() c) cap() d) filter() Answer: a) limit() Explanation: The limit() method in the Stream API is used to limit the number of elements in a stream to a specified maximum size. This method is particularly useful when you […]
Which method is used to limit the number of elements in a stream? Read More »