How to compare two hashmaps in java?

前端 未结 4 1847
眼角桃花
眼角桃花 2020-12-06 15:50

I have two hash maps like the following:

1.=============Employee=================


Key : 1_10 : Value : 13/04/2012
Key : 1_11 : Value : 18/04/2012
Key : 1_         


        
4条回答
  •  独厮守ぢ
    2020-12-06 16:38

    Can you please try like this.

        HashMap employeeMap = new HashMap();
    
        HashMap workingdaymap = new HashMap();
    
        Set values1 = new HashSet(employeeMap.values());
        Set values2 = new HashSet(workingdaymap.values());
        boolean equal = values1.equals(value2);
    

提交回复
热议问题