示例代码
import java.util.ArrayList; import java.util.Collections; import java.util.List; public class Test1 { public static void main(String[] args) throws Exception { List<Integer> list = new ArrayList<Integer>(); list.add(7); list.add(2); list.add(9); System.out.println(list); Collections.reverse(list); System.out.println(list); } }
输出结果
[7, 2, 9] [9, 2, 7]
95崔国权(mobei) 2025-04-02
95崔国权(mobei) 2025-04-02
95崔国权(mobei) 2025-04-02
藏家519 2025-04-03
马踏飞燕 2025-04-03
1 2025-04-03
彭于晏东北分晏 2025-04-02
藏家574 2025-04-02
一耶暴富 2025-04-02
藏家197 2025-04-02