[JAVA] I have a question about HASH in HASH.

Asked 2 years ago, Updated 2 years ago, 122 views

Hello, I am a student studying Android.

HASH is in the HASHMAP.

Well, to put it simply,

KEY : value

A : 1

B : 2

C : 3

D : 4

E : 5

There's this HASH, and dozens of these types of hashes have gone into the new hash.

HASH

    HASH
            HASH
                    {
                        A : 1

                        B : 2

                        C : 3

                        D : 4

                        E : 5
                  }

            HASH
                    {
                        A : 1

                        B : 2

                        C : 3

                        D : 4

                        E : 5
                  }
                HASH
                    {
                        A : 1

                        B : 2

                        C : 3

                        D : 4

                        E : 5
                  }
    }

In this form, there is HASH in HASH, so how can each hash inside be recalled?
When using the SIZE() function, count exactly how many.

for(String key : hashMap.keySet()){

        String value = hashMap.get(key);

        System.out.println(key+" : "+value);

    }

There's an error using crying Can I use HASH data in HASH?

hash map

2022-09-22 21:35

1 Answers

If there is a map in the map, the value will be the map

Map innerMap = hashMap.get(key);
innerMap.get(innerKey);

It should be like this. By the way, don't you designate a generic in the declaration?


2022-09-22 21:35

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.