フリー問題

Java SE 17 Developer のフリー問題 11 / 20 問目

問題文

A pipeline calls stream on a list, then filter, then map, and the method returns without any further call. A log line inside the filter never appears. Why?

選択肢

  1. The filter stage runs on a background thread that the pipeline starts, so its output is written after the method has already returned to its caller
  2. The list was empty at that moment, so no element ever reached the predicate that the filter stage holds
  3. The map stage replaced the filter stage during optimization, because the two stages are merged into one pass over the elements
  4. No terminal operation was called at all, so the intermediate stages were only described and never run

解答・解説を確認するには

正解と解説の確認、回答の記録には無料登録が必要です。登録すると演習モードでフリー問題に回答し、正誤と解説をその場で確認できます。