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 7949457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:00:18+00:00 2026-06-04T02:00:18+00:00

I am iterating over hashmap, but these strange brackets [ ] are there while

  • 0

I am iterating over hashmap, but these strange brackets [ ] are there while iterating, Can any body guide me how can i get rid of it.

Thanks

 Iterator it = map.entrySet().iterator();

            while (it.hasNext()) {

                Map.Entry pairs = (Map.Entry)it.next();                 
                System.out.println(pairs.getKey() + " = " + pairs.getValue());                      
                Log.v("Pairs get key", pairs.getKey().toString());
                Log.v("Pairs get value", pairs.getValue().toString());
                mysection.add(pairs.getKey().toString());
                temp.add(pairs.getValue().toString());

                it.remove(); // avoids a ConcurrentModificationException

            }
  • 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-04T02:00:19+00:00Added an answer on June 4, 2026 at 2:00 am

    Ok, i got the answer, the problem was map when displayed into console will show , and [] symbol. So to avoid it use another implementation to iterate over map and not this one.

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

Sidebar

Related Questions

Is there a better shorter way than iterating over the array? int[] arr =
I'm iterating over records and want to create the toggle-options for records but I
I am iterating over input elements using .each() and want to get class of
I am iterating over some elements and I have found that document.getElementById(id) works, but
If I modify a Collection while iterating over it using for-each loop, it gives
I am iterating over an array in MooTools but seeing additional items when iterating
Is there a performance hit when iterating over object attributes vs. iterating an array?
How do I access the index while iterating over a sequence with a for
I get a segmentation fault when iterating over a set. The stack trace points
Is it possible to add elements to a collection while iterating over it? More

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.