SyntaxFix
Write A Post
Hire A Developer
Questions
The first one .clear(); will keep the same list just clear the list.
.clear();
The second one new ArrayList<Integer>(); creates a new ArrayList in memory.
new ArrayList<Integer>();
ArrayList
Suggestion: First one because that's what is is designed to do.