Don't say much, go straight to the subject, follow the small weave to look down:
1. First convert the Map object to set and then to the iterator
Iterator iterator = Map.entryset (). iterator ();
while (Iterator.hasnext ()) {
Entry Entry = Iterator.next ();
System.out.println (Entry.getkey ()); Gets the key
System.out.println (Entry.getvalue ()); Get value
2. First convert map to set type key value set and then to iterator
Iterator iterator = Map.keyset (). iterator ();
while (Iterator.hasnext ()) {
Object key = (object) iterator.next ();
SYSTEM.OUT.PRINTLN (key); Gets the key
System.out.println (Map.get (key)); Get Value
}
The above is the entire content of this article, I hope the content of this article for everyone's study or work can bring some help, if there are questions you can message exchange, but also hope that a lot of support cloud Habitat community!