Here you can find the source of removeIgnoreCase(Iterable
needle
(ignoring case)
Parameter | Description |
---|---|
haystack | The iterable list or set to search in |
needle | The value to search for |
public final static boolean removeIgnoreCase(Iterable<String> haystack, String needle)
//package com.java2s; //License from project: Open Source License import java.util.Iterator; public class Main { /**// ww w . ja v a 2s . c om * Remove the first occurrence of <code>needle</code> (ignoring case) * * @param haystack * The iterable list or set to search in * @param needle * The value to search for * @return True if an element was removed otherwise false */ public final static boolean removeIgnoreCase(Iterable<String> haystack, String needle) { Iterator<String> iterator = haystack.iterator(); while (iterator.hasNext()) { String string = iterator.next(); if (needle.equalsIgnoreCase(string)) { iterator.remove(); return true; } } return false; } }