Here you can find the source of removeStartsWith(String prefix, List
public static void removeStartsWith(String prefix, List<String> lines)
//package com.java2s; // are made available under the terms of the Eclipse Public License v1.0 import java.util.List; import java.util.ListIterator; public class Main { public static void removeStartsWith(String prefix, List<String> lines) { ListIterator<String> it = lines.listIterator(); while (it.hasNext()) { String line = it.next(); if (line.startsWith(prefix)) { it.remove();//www .java2 s . c o m } } } }