0

I am trying to remove an element from an array and return it. I am using a temporary variable to store the element before I make it null. However I get a null pointer exception. The array is used to store the key and the value of a Hashmap, map

    if (map[location].getKey().equals(k)) {

        V temp = map[location].getValue();
        map[location]=null;
        return temp;


    }

0 Answers0