Different ways to iterate HasMap

Tutorials Shared by the Internet Community

Advertisements

  Top Tutorials     New Tutorials     Submit     Login     Register  

Tutorial Detail

Different ways to iterate HasMap

We have different ways to iterate HashMap. Using keySet,entrySet by using Map.Entry we can do the iterations. as well as we can use for-each loops.
http://javabynataraj.blogspot.in/2014/06/how-to-iterate-or-traverse-map-in-java.html
  • Total Hits: 6776

  • Average Rating :
    URL RatingURL RatingURL RatingURL RatingURL Rating

  •  

  • Total Votes: 47 votes

  • Category: JAVA/Collections

  • Submitted on: 2014-07-08 07:52:22

  • Submitted By: Muralidhar

  • Set as Favorite

Description:

Iterating a Map is not like a List Iteration. Map is having key-value pair to store the elements. Based on key,we can retrieve mapped value.To Iterate or loop a map we have 3 ways using with the help of Map.Entry, keySet() and entrySet()methods.    More detail...

Rating Detail

 Stars  Percentage  Total Vote
 One star  Vote LeftVote MiddleVote Right 80.85%  38
 Two starsTwo star  Vote LeftVote MiddleVote Right 6.38%  3
 Three starsThree starsThree stars  Vote LeftVote MiddleVote Right 2.13%  1
 Four starsFour starsFour starsFour stars  Vote LeftVote MiddleVote Right 2.13%  1
 Five starsFive starsFive starsFive starsFive stars  Vote LeftVote MiddleVote Right 8.51%  4

Caste Your Vote

 Rating  Selection  Guidelines
 Poor:     Very disappointing, useless.
 Fair:     Below average, disappointing but not useless.
 Good:     About average in its class.
 Very Good:     Above average for its category.
 Excellent:     One of the best Tutorials in its category.






Advertisements