containsValue(Object value) 
          Returns true if this map maps one or more keys to the specified value.

解决方案 »

  1.   

    只用containsValue(Object value) 就可以判断了是否重复。
    如果你想挑出来:
    假设map是你的,则:
    import java.util.*;public class MainTest
    {
        public MainTest()
        {
        }
        public static void main(String[] args)
        {
            java.util.Map map = new java.util.HashMap();
            map.put("1","2");
            map.put("2","1");
            map.put("3","3");
            map.put("4","3");
            map.put("5","1");
            System.out.println(map.toString());
            Object[] itemKeyList = new Object[map.size()];
            map.keySet().toArray( itemKeyList );
            int groupCnt=0;
            String s = "";
            for(int i=0;i<map.size()-1;i++)
            {
                s = "";
                for (int j = i + 1; j < map.size(); j++)
                {
                    if (map.get(itemKeyList[j]).equals(map.get(itemKeyList[i])))
                    {
                        s = "(" + itemKeyList[i] + "," + map.get(itemKeyList[i]) +
                            ")";
                        s += "<---->";
                        s += "(" + itemKeyList[j] + "," + map.get(itemKeyList[j]) +
                            ")";
                        s +="\n";
                    }
                }
                if (!s.equals(""))
                {
                    groupCnt++;
                    System.out.println("Group:" + groupCnt);
                    System.out.println(s);
                }
            }
        }
    }
      

  2.   

    从键值里面
    containsKey()从值里面
    containsValue
      

  3.   

    输出结果如下:
    {3=3, 5=1, 2=1, 4=3, 1=2}   //假设是你的map。Group:1                      //输出的第一组数值重复的(3,3)<---->(4,3)
    Group:2                     //输出的第二组数值重复的             (5,1)<---->(2,1)