package com.yuzhenc.collection;
import java.util.ArrayList;
import java.util.Collections;
public class Test19 {
public static void main(String[] args) {
ArrayList<String> arrayList = new ArrayList<>();
arrayList.add("abc");
arrayList.add("def");
arrayList.add("ghi");
Collections.addAll(arrayList,"jkl","mno");
System.out.println(arrayList);
Collections.sort(arrayList);
System.out.println(arrayList);
System.out.println(Collections.binarySearch(arrayList,"ghi"));
ArrayList<String> arrayList1 = new ArrayList<>();
arrayList1.add("aa");
arrayList1.add("bb");
System.out.println(arrayList);
System.out.println(arrayList1);
Collections.copy(arrayList,arrayList1);
System.out.println(arrayList);
System.out.println(arrayList1);
Collections.fill(arrayList,"zzz");
System.out.println(arrayList);
}
}
|