The fill() method of java. util. Collections class is used to replace all of the elements of the specified list with the specified element.
The fill() method of java. util. Collections class is used to replace all of the elements of the specified list with the specified element.