I have following String Array
tmp = [null, null, null, Mars, Saturn, Mars]
coming after doing the operation -
allSig[d3].split(" ");
where allSig
is an array of Strings. The null value is empty value in the array. Now I want to remove the null. For this I am using
tmp[indexNumber] != null
is not working and giving true ; taking null as the value. Even if i am using "null" as a string is not working.
How to remove this.
public static String[] removeElements(String[] allElements) {
String[] _localAllElements = new String[allElements.length];
for (int i = 0; i < allElements.length; i++)
if (allElements[i] != null)
_localAllElements[i] = allElements[i];
return _localAllElements;
}