Java – search for HashMap in the ArrayList of HashMap

I have an ArrayList of HashMap I want to search for HashMap in it, but I can't find a way to do this What do you suggest I do?

Solution

Answer your question in a way I understand!

for (HashMap<String,String> hashMap : yourArrayList)
    {
        // For each hashmap,iterate over it
        for (Map.Entry<String,String> entry  : hashMap.entrySet())
        {
           // Do something with your entrySet,for example get the key.
           String sListName = entry.getKey();
        }
    }
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>