Return to site

JAVA CERTIFICATION QUESTION: Java Stream API

· java,ocp

Given:

broken image

What is the output?

  • A. The compilatin fails
  • B. [ab, cdefghij]
  • C. [abcdefghij]
  • D. [ab, cdef, ghij]
  • E. [a, b, cd, ef, ghij]

#java #certificationquestion #ocp

The static factory method Collectors.groupingBy() provide us with functionality similar to the ‘GROUP BY' clause in the SQL language.

We use it for grouping objects by some property and storing results in a Map instance.

The joining() method of Collectors Class, in Java, is used to join various elements of a character or string array into a single string object.

·ꓷ sᴉ ɹǝʍsuɐ ǝɥꓕ