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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:36:24+00:00 2026-05-25T23:36:24+00:00

I have a map created from a json string that is sorted in the

  • 0

I have a map created from a json string that is sorted in the order I need to parse in.

If there is a key at index 6 (7th key), I want to be able to iterate from this key to the end of the map and do what processing I need with these key/value pairs.

Is there anyway to do this?

  • 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-05-25T23:36:24+00:00Added an answer on May 25, 2026 at 11:36 pm

    A Map doesn’t in general maintain an order of the keys. You’ll need to use

    • A NavigableMap, such as TreeMap. Preferable if your keys have a natural order.
    • A LinkedHashMap which is a map implementation which preserves the insertion order.

    Example snippet (LinkedHashMap):

    Map<Integer, String> map = new LinkedHashMap<Integer, String>();
    
    map.put(1, "one");
    map.put(2, "two");
    map.put(3, "three");
    map.put(4, "four");
    map.put(5, "five");
    map.put(6, "six");
    map.put(7, "seven");
    map.put(8, "eight");
    map.put(9, "nine");
    
    int index = 0;
    for (Integer key : map.keySet()) {
        if (index++ < 6)
            continue;
    
        System.out.println(map.get(key));
    }
    
    // Prints:
    //     seven
    //     eight
    //     nine
    

    Example snippet (TreeMap):

    TreeMap<Integer, String> map = new TreeMap<Integer, String>();
    
    map.put(5, "five");
    map.put(6, "six");
    map.put(7, "seven");
    map.put(8, "eight");
    map.put(9, "nine");
    
    for (Integer key : map.tailMap(6).keySet())
        System.out.println(map.get(key));
    
    // Prints
    //     six
    //     seven
    //     eight
    //     nine
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a function that loops through a set of returned JSON. I
I have .MAP file which is created from SAS XML mapper. As the name
Basically I have a set of checkboxes that are dynamically created from view data
Hi I have created an activity which pulls data from json format text and
I have an image created from the Google Maps API static map library and
I need to create a map/array for auto complete from a JSON response and
I have an ArcGIS map created with Flex. The labels created dynamically are the
I am new to iphone development.I have created map applications and displayed the cuurent
I have unsorted map of key value pairs. input = { xa => xavalue,
I have a Map which is to be modified by several threads concurrently. There

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.