Java tutorial
//package com.java2s; //License from project: Apache License import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; public class Main { /** * Remove um string da tabela de espalhamento caso seja igual ao parametro 'newString' * * @param vehiclesMap */ public static void removeOutStringsStrings(Map<String, String> map, String newString) { for (Iterator<Entry<String, String>> iterator = map.entrySet().iterator(); iterator.hasNext();) { Map.Entry<String, String> entry = (Map.Entry<String, String>) iterator.next(); String key = entry.getKey(); // List<String> value = entry.getValue(); if (key.equals(newString)) { iterator.remove(); } } // System.out.println("Lista: " + vehicles.size()); } }