findFirst() and findAny() are short-circuiting terminal operations that each return an Optional wrapping a single stream element. findFirst() guarantees the element that appears first in encounter order, while findAny() makes no such guarantee.
list.stream().filter(x -> x > 10).findFirst() reliably returns the first element greater than 10, while list.parallelStream().filter(x -> x > 10).findAny() may return any qualifying element, potentially different across runs.
List<Integer> nums = Arrays.asList(3, 7, 15, 22, 9);
Optional<Integer> first = nums.stream()
.filter(n -> n > 10)
.findFirst();
Optional<Integer> any = nums.parallelStream()
.filter(n -> n > 10)
.findAny();A concise interview answer is
findFirst() always returns the first matching element in encounter order, so it's deterministic. findAny() can return any matching element and doesn't guarantee order, which lets parallel streams return faster because they don't need to coordinate on which element came first. I use findAny() only when order genuinely doesn't matter.
Last updated: 16 July 2026
Previous question: How do you handle null values in Java 8 using Optional?
Next question: Explain the purpose of the Collectors class in Java 8.