Map<String, Object> m = new HashMap<>();
    ArrayList<String> str = new ArrayList<String>(Arrays.asList("Mohan", "Rohan", "", null));
    m.put("k1", str);
    m.put("k2", 43);
    m.put("k3", null);
    m.put("k4", "");
    System.out.println(m);
    Set<Map.Entry<String, Object>> entrySet = m.entrySet();
    Iterator<Map.Entry<String, Object>> itr = entrySet.iterator();
    while (itr.hasNext()) {
        Map.Entry<String, Object> entry = itr.next();
        if (entry.getValue() == null || entry.getValue().toString().equals("")) {
            itr.remove();
        } else if (entry.getValue().getClass() == ArrayList.class) {
            ArrayList<String> arr = (ArrayList<String>) entry.getValue();
            for (int i = 0; i < arr.size(); i++) {
                if (arr.get(i) == null || arr.get(i).trim() == "") {
                    arr.remove(i);
                }
            }
        }
    }
I am getting stuck to remove empty and null values from arraylist Can anyone help me with this...
 
     
    