数组转变为list,调用Arrays类的静态方法asList。
Integer[] ar = new Integer[]{1,2,3};
List<Integer> i = Arrays.asList(ar);
list转变为数组,调用toArray方法。
List<Long> list = new ArrayList<>();
List<GamePlatform> games = gamePlatform.getUseGames(status, platformId);
for(GamePlatform game : games) {
list.add(game.getGameId());
}
Long[] arr = list.toArray(new Long[list.size()]);