how to use the foreach function with java maps code example Example: inline foreach java names.forEach(name -> System.out.println(name));