list - Remove all Elements With a Custom Null Value Java -


so i've been working on code , have custom class named word. here have list of words (dupewordlist) , remove words list have value of null. keep in mind, value variable inside word class. word class contains following stored values: frequency (int) value (string)

is there anyway remove words when call word.getvalue() returns null? surely there way this. if loop through entire list , process.

code:

list<word> dupewordlist; dupewordlist = new arraylist<>(wordlist); dupewordlist.removeall(collections.singleton(null)); 

in java 8 do

dupewordlist.removeif(e -> e.getvalue() == null) 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -