Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8244383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:50:08+00:00 2026-06-07T21:50:08+00:00

I understand that to iterate through a Map , I need to use the

  • 0

I understand that to iterate through a Map, I need to use the entrySet() method and then use the Iterator on the resultant Set. I feel the question might be silly, but, how is the Map exactly implemented so that using an Iterator on it directly isn’t possible? As far as I understand, Map isn’t a collection, and Iterator is meant to be used over a collection. But logically, isn’t Map also a collection of key-value pair(though it doesn’t implement the Collection interface)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T21:50:10+00:00Added an answer on June 7, 2026 at 9:50 pm

    AFAIK, You can’t iterate over a Map directly because there are three types of iteration that a Map supports and there was no clear reason to choose one of the other. Doing the equivalent entrySet().iterator() may have been reasonable, but it’s not the choice which was made.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I understand that the Set returned from a Map's keySet() method does not guarantee
I understand that this question may be subjective, this is why I need an
I understand that we can set the various style attributes from code behind using
I have a collection of objects that I would like to iterate through to
That is a followup from my previous question , but you don't need to
Most examples of inplace editing are one-liners that iterate through a file or files,
I have class method that returns a list of employees that I can iterate
I have a IList of Client type. I would need to iterate through it
I need to iterate through all of the collections in my MongoDB database and
I need to iterate through a large XML file (~2GB) and selectively copy certain

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.