How do you clear an ArrayList?
Answer
There are two ways to empty an ArrayList – By using
ArrayList.clear() method or with the help of ArrayList. removeAll() method. Although both methods do the same task the way they empty the List is quite different.