inblog logo
|
An's Blog
    JAVA

    [JAVA] 48. 람다의 활용

    윤설안's avatar
    윤설안
    Feb 18, 2025
    [JAVA] 48. 람다의 활용
    💡
    라이브러리에 있는 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

    An's Blog

    RSS·Powered by Inblog