5 Ways to Iterate a Map in Java - Simple and Easy!
HTML-код
- Опубликовано: 11 сен 2024
- Do you know there are 5 different ways you can use to write code that iterates a Map in Java Collections framework? In this video, I'm happy to show you these 5 ways to iterate a Map in Java with simple and easy to understand code examples.
The 5 ways to iterate maps in Java are:
1. Use while loop on keySet iterator
2. Use enhanced for loop on keySet
3. Use enhanced for loop on entrySet
4. Use forEach with Lambda expression
5. Use Stream API with forEach on entrySet
thanks a lot.
Most welcome!
Hello Sir, Why are your video getting late sir...Your teaching style is great sir...
it's because i'm busy. I'm trying to publish more regular. Thanks and enjoy!
which way is the most efficient one ?
I think the iterator way, because all other ways will end up using iterator internally.
🖖🖖🖖💪💪💪😻😻😻Nam Good Morning. Best Dude of the Java Spring Boot Framework
Thanks. But this video is not about Spring Boot. it's about Java Collections.
@@CodeJava Java is in Spring Boot isnt it? Perfect so, far so good 🤣🤣🤣