Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
新しい Java 8 を使用してマップ内のすべてのエントリを反復処理する最も簡単な方法は何ですか?
Map 内のすべてのエントリを反復処理するには、これが最も簡潔で簡単な方法だと思います。
マップを作成:
Map map = new HashMap() {{ put("key1", "value1"); put("key2", "value2"); }};
すべてのキーと値を確認します。
map.forEach( (k, v) -> System.out.println("key: " + k + " value: " + v) );