可以将Map <Integer,ArrayList <String >>与ArrayList <String>的值进行比较

I created a Map<Integer, ArrayList<String>> map and I would like to compare each value in map with one ArrayList<String> likeList and get key if they match. I will bring the key to use later.

我试图像这样运行我的代码,但是它不起作用,因为它什么也不返回:

for (int key : map.keySet()) {
    if(map.get(key).equals(likeList)){
        index = key;
        Log.d("IndexN", String.valueOf(index));
    }
}

然后,我尝试了这个:

int index = 0;
for (Map.Entry<Integer, ArrayList<String>> entry : map.entrySet()) {
    if(entry.getValue().equals(likeList)){
        index = entry.getkey();
    }
}

你有什么主意吗?