라이브러리에 있는 removeIf 람다 함수를 사용하여 a가 포함되어 있는 글자를 없애기.
package ex07.ch02;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Beh03 {
public static void main(String[] args) {
// String s = "hello";
// System.out.println(s.startsWith("h")); // startWith = h로 시작하면 true, 아니면 false
List<String> words = new ArrayList<String>();
words.add("apple");
words.add("banana");
words.add("cherry");
words.removeIf(s -> s.contains("a"));
System.out.println(words);
}
}
Share article