您应该使用
add而不是
set:
int x = al.size()/2 + (al.size()%2) - 1;for(int i = 0; i < x; i++){ firstHalf.add(al.get(i)); }最好使用List#subList

您应该使用
add而不是
set:
int x = al.size()/2 + (al.size()%2) - 1;for(int i = 0; i < x; i++){ firstHalf.add(al.get(i)); }最好使用List#subList