← Unit 4 · all exercises
Saved in this browser only

Initials from a list

Return the first letter of every name in the list, joined together and in capitals. An empty list gives an empty String.

String initials(java.util.ArrayList<String> names)

Solution.java
Loading editor…
Results

Examples

  • Solution.initials(new java.util.ArrayList<>(java.util.List.of("Ada", "Lovelace"))) → AL
  • Solution.initials(new java.util.ArrayList<>(java.util.List.of("grace", "hopper"))) → GH

There are also 3 hidden tests you can't see. Solve the problem, not the examples.