1.ArrayList< xxx >转化为数组
ArrayList<Job> waitingJobsList = fairQueue.getWaitingJobs();
Job[] waitJobsArr =
waitingJobsList.toArray(new Job[waitingJobsList.size()]);
2.数组转化为ArrayList< xxx >
ArrayList<Job> waitJobs =
new ArrayList<Job>(Arrays.asList(waitJobsArr));
下面是错误用法,注意不要使用!
ArrayList<Job> waitJobs =
(ArrayList<Job>) Arrays.asList(waitJobsArr);