i'm trying to replace null values in my arrayList but I get exception
java.lang.NullPointerException
I have tried different way :
Data.replaceAll(s -> s.replaceAll(" null", ""));
And :
for(int x = 0; x < Data.size(); x++)
{
if(Data.get(x).equals("null") == true)
{
Data.set(x, "");
}
}
And :
for(int x = 0; x < Data.size(); x++)
{
if(Data.get(x).equals(null) == true)
{
Data.set(x, "");
}
}
but an exception is throw java.lang.NullPointerException
Here is an exemple of my arrayList:
[0050568D6268, null, A001, A, T3, Principal, COL - Test, 4-Lock, Com. On Stage, Social, RDC, null, null, null, null, -1, null, -1, 0, -1, 99, 53]
I'm looking for any help thanks.
nulland"null"are two very different things.Data.get(x).equals(null)would not throw an exception when that entry isnul? Since when can someone call a method like.equalson a null object?