将数组转换为集合
import java.util.Arrays; import java.util.HashSet; import java.util.LinkedList; import java.util.List;/*来 自 NowJava.com - 时代Java*/ import java.util.Set; public class Main { public void main(String[] argv) { int[] array = null; // Fixed-size list List list = Arrays.asList(array); // Growable list list = new LinkedList(Arrays.asList(array)); // Duplicate elements are discarded Set set = new HashSet(Arrays.asList(array)); } }