Filter non-null strings

    0

    7

    filterstream
    Java Public Recipes

    Filter strings that are non-null from a list

    import java.util.List;
    
    // Filter string that have a non-null length
    List<String> newList = initialList.stream().filter(p -> s.length > 0).collect(Collectors.toList());
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.