Java Array Remove removeNullsFromStringArray(String[] array)

Here you can find the source of removeNullsFromStringArray(String[] array)

Description

remove Nulls From String Array

License

Apache License

Declaration

public static String[] removeNullsFromStringArray(String[] array) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.ArrayList;

public class Main {
    public static String[] removeNullsFromStringArray(String[] array) {
        ArrayList<String> arrayList = new ArrayList<String>();
        for (int i = 0; i < array.length; i++) {
            if (array[i] != null && !array[i].equals("")) {
                arrayList.add(array[i]);
            }// w  w  w . j  a  va2 s .  com
        }
        String[] newArray = arrayList.toArray(new String[arrayList.size()]);
        return newArray;
    }
}

Related

  1. removeNullElements(String[] x)
  2. removeNulls(Object[] arr)
  3. removeNulls(T[] array)
  4. removeNulls(T[] array)
  5. removeNulls(T[] input)
  6. removeOwnCookieNameFromCookieHeader(String ownCookieName, String[] cookies)
  7. removePointerFromDesc(String[] desc)
  8. removeRepeats(T[] array)
  9. removeRows(int[][] array, Collection rowsIndices)