List<String> list = new ArrayList<>();
list.add("aaa");
list.add(null);
list.add("bbb");
list.add(null);
list.removeAll(Collections.singleton(null));
//→”aaa”,"bbb"だけになる
Collections.singletonは特定の要素を含むimmutableなSetを返すstaticファクトリメソッド
Go to list of users who liked
More than 5 years have passed since last update.
List<String> list = new ArrayList<>();
list.add("aaa");
list.add(null);
list.add("bbb");
list.add(null);
list.removeAll(Collections.singleton(null));
//→”aaa”,"bbb"だけになる
Collections.singletonは特定の要素を含むimmutableなSetを返すstaticファクトリメソッド
Register as a new user and use Qiita more conveniently
Go to list of users who liked