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.
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.
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:)
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?