Is there a way to access each object more efficiently when writing a data structure map?

Asked 2 years ago, Updated 2 years ago, 154 views

I'd like to check all the mapped pairs by rotating the repeat statement. What's the most efficient way? And does the order of the objects change depending on the map implementation?

java dictionary iteration

2022-09-22 22:38

1 Answers

Yes, the order changes depending on the implementation.

    for (Map.Entry<String, String> entry : map.entrySet())
    {
        System.out.println(entry.getKey() + "/" + entry.getValue());
    }

I think this is the best way to approach it.


2022-09-22 22:38

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.