Several collections exist, but your probably looking for ArrayList
In Python you can simply declare a list like so:
myList = []
and begin using it.
In Java, it better to declare from the interface first so:
List<String> myList = new ArrayList<String>();
Python Java
append add
Remove remove
len(listname) list.size
Sorting a List can require a little more work, for example, depending on the objects you may need to implement Compactor
or Comparable
.
ArrayList
will grow as you add items, no need to extend it on your own.
As for reverse()
and pop()
, I'll refer you can refer to:
How to reverse a list in Java?
How to pop items from a collection in Java?