1. Learn
  2. /
  3. Courses
  4. /
  5. Input/Output and Streams in Java

Connected

Exercise

Processing usernames for display

In a user management system, we need to display usernames stored in a database. Using Streams and .forEach(), we can efficiently process and print each username without using traditional loops.

All the necessary classes from java.util have been imported for you.

Instructions

100 XP
  • Convert the usernames list into a Stream object.
  • Print each element in the stream using a lambda expression.