The following are three static methods of the class Collections that add or replace elements in a collection:
- boolean addAll(Collection<T> c, T... elements): Adds all the provided elements to the provided collection; if the provided element is Set, only unique elements are added. It performs significantly faster than the addAll() method of the corresponding collection type.
- boolean replaceAll(List<T> list, T oldVal, T newVal): Replaces every element in the provided list that is equal to oldValue with the newValue; when oldValue is null, the method replaces every null value in the provided list with the newValue. It returns true if at least one element was replaced.
- void fill(List<T> list, T object): Replaces every ...