map.put(null,null);
map.put(null,"D");
map.put(null,"E");
What will be the output of
System.out.println(map)
will for the null key it will print the last key value pair , i.e.
map.put(null,null);
map.put(null,"D");
map.put(null,"E");
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
public class HashTableHashMap
{
public static void main(String[] args) {
Map map = new HashMap();
map.put("a",null);
map.put("b","B");
map.put(null,"D");
System.out.println(map);
Hashtable ht = new Hashtable();
Set set = map.entrySet();
Iterator itr = set.iterator();
while(itr.hasNext()){
Map.Entry entry = (Map.Entry)itr.next();
Object key = entry.getKey();
Object val = entry.getValue();
if(key==null){
key = ""+null; // Or whatever you want
}
if(val==null){
val = ""+null; // Or whatever you want
}
ht.put(key,val);
}
System.out.println(ht);
}
}
FacesContext facesContext = event.getFacesContext();
HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
response.addHeader("Pragma", "no-cache");
response.addHeader("Cache-Control", "no-cache");
response.setHeader("Cache-Control", "no-store");
response.addHeader("Cache-Control", "must-revalidate");
public void setLength(int newLength)You may have the case like