I want to remove all empty element.. I use code below this, but did not working..
sejarahToken.removeAll(Collections.singleton(""));
sejarahToken.removeAll(Arrays.asList(""));
for (String st : sejarahToken) {
writingFile(st);
}
same as using this code:
sejarahToken.removeAll(Collections.singleton(null));
sejarahToken.removeAll(Arrays.asList(null,""));
Here's output the sejarahToken arraylist on txt file.. there are still empty values:
Leonardo
da
Vinci
dari
Italia
dan
Otto
Lilienthal
dari
Jerman
telah
mendahuluinya
Tetapi
ternyata
jauh
sebelumnya
semua
sudah
didahului
oleh
seorang
writingFilelooks like. Have you tried debugging through the code to see what the list looks like after the call toremoveAll?