Deleting an Object as a key in a Java Map [closed]

1

How to delete an object that is saved as a key in a Map list, passing it by parameters and searching it within the Map and checking if it exists and then deleting it.

    
asked by Francisco José Tiscar Romero 30.01.2018 в 18:32
source

2 answers

1

I hope the following code helps you:

    HashMap<Object,String> map = new HashMap<Object, String>();

    private void eliminarObjeto(Object objeto){
        if(map.containsKey(objeto)){
            map.remove(objeto);
        }
    }

Greetings:)

    
answered by 30.01.2018 / 18:42
source
0

Thanks For the Answer, it has been very helpful, but when it comes to deleting the specific object, it deletes all the Map list, and I have passed on the specific object, do you know what it could be?

    
answered by 30.01.2018 в 19:16