java.util.Collections.fill() 方法 java.util.Collections.enumeration() 方法 java.util.Collections.frequency() 方法 java.util.Collections.fill() 方法 package com.codingdict; import java.util.*; public class CollectionsDemo { public static void main(String args[]) { // create array list object List arrlist = new ArrayList(); // populate the list arrlist.add("A"); arrlist.add("B"); arrlist.add("C"); System.out.println("List elements before fill: "+arrlist); // fill the list with 'TP' Collections.fill(arrlist,"TP"); System.out.println("List elements after fill: "+arrlist); } } java.util.Collections.enumeration() 方法 java.util.Collections.frequency() 方法