There are some options.
You can always pass a list as a method parameter.
One important note: you are not calling
CHANGEME from
main so its code will never be executed.
Second important thing (a litle offtop
).
Instead of declaring
use
This way if you ever changed your mind and wanted a different type of list you would need to do less changes in your code.
Second, if you use java 1.7 or above this declaration can be simplified to
But do not simplify it like this:
This would just use raw
ArrayList without type-checking.