Article
home/blog/Loading

How to create an empty list in Java

Lists in Java are pretty powerful and this is how you create them

For a list you will never populate with items

List<Integer> list = Collection.emptyList()

For a list you will add items to

List<Integer> list = new ArrayList<>()