I need to find the intersection between 2 hash maps where the value is a String array, It seems that the retainAll() compares arrays by address, Is there any way to make retainAll() works that way I expected?
String[] aa={"aa"};
String[] bb={"aa"};
Map<String, String[]> requestParameters=new HashMap<String, String[]>();
requestParameters.put("A",aa);
Map<String, String[]> redirectParameters=new HashMap<String, String[]>();
redirectParameters.put("A",bb);
Map<String, String[]> intersectionMap = new HashMap<>(requestParameters);
intersectionMap.entrySet().retainAll(redirectParameters.entrySet());
System.out.println(""+ intersectionMap.entrySet());