Here you can find the source of removeOutStrings(Collection
Parameter | Description |
---|---|
values | a parameter |
public static void removeOutStrings(Collection<String> values, String newString)
//package com.java2s; //License from project: Apache License import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; public class Main { /** //w ww. j a v a 2s .co m * Remove um string da colecao caso seja igual ao parametro 'newString' * * @param values */ public static void removeOutStrings(Collection<String> values, String newString) { for (Iterator<String> iterator = values.iterator(); iterator.hasNext();) { String tmp = (String) iterator.next(); if (tmp.equals(newString)) { iterator.remove(); } } // System.out.println("Lista: " + vehicles.size()); } /** * Remove um string da tabela de espalhamento caso seja igual ao parametro 'newString' * * @param vehiclesMap */ public static void removeOutStrings(Map<String, List<String>> map, String newString) { for (Iterator<Entry<String, List<String>>> iterator = map.entrySet().iterator(); iterator.hasNext();) { Map.Entry<String, List<String>> entry = (Map.Entry<String, List<String>>) iterator.next(); String key = entry.getKey(); // List<String> value = entry.getValue(); if (key.equals(newString)) { iterator.remove(); } } // System.out.println("Lista: " + vehicles.size()); } }