Map<String,String> map=request.getParameterMap();
^ is the unmodifiable map.
Set s1= map.keySet();
Set s2= map2.keySet();/* another keyset of local map*/
Using s1.retainAll(s2) throws an exception: at java.util.collections$unmodifiablecollection.retainall
Here request.getParameterMap() returns an unmodifiable map.. I tried creating a local map. But the issue stil persists.
Suggest some solution.
You are not allowed to modify the keyset of an unmodifiable map as the keyset returned is also unmodifiableSet. You can create a local map from the unmodifiableMap and than use retainAll on local map keyset.