Java List Remove removeEmptyStringsInList(List list)

Here you can find the source of removeEmptyStringsInList(List list)

Description

remove Empty Strings In List

License

Open Source License

Declaration

public static List<String> removeEmptyStringsInList(List<String> list) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;

import java.util.List;

public class Main {
    public static List<String> removeEmptyStringsInList(List<String> list) {
        List<String> newList = new ArrayList<String>();
        for (String s : list) {
            if (!s.isEmpty()) {
                newList.add(s.trim());//  w  ww .  j ava 2s . co m
            }
        }

        return newList;
    }
}

Related

  1. removeEmptyLines(List lines)
  2. removeEmptyLinesFromEnd(List list)
  3. removeEmptyLinesOnSides(List lines)
  4. removeEmptyLists(Map map)
  5. removeEmptyStringsFromList(List list)
  6. removeEmptyTags(List tags)
  7. removeEmptyValues(final List values)
  8. removeFrom(List col, int from)
  9. removeFrom(List list, T member)