Java中的数组列表 [英] List of Arrays in Java

查看:243
本文介绍了Java中的数组列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是使得Java数组的一个列表的语法?

我曾尝试以下内容:

 列表< INT [] GT; A =新的List< INT []>();

和很多其他的东西。

我需要能够重新排序整型阵列,但整型阵列的元件不需要被改变。如果这是不可能的,为什么呢?

感谢您。


解决方案

首先,你不能做新名单(); 这是一个接口。

为使廉政阵列的列表,做这样的事情:

 列表< INT [] GT; myList中=新的ArrayList< INT []>();

What is the syntax for making a List of arrays in Java?

I have tried the following:

List<int[]> A = new List<int[]>();

and a lot of other things.

I need to be able to reorder the int arrays, but the elements of the int arrays need not to be changed. If this is not possible, why?

Thank you.

解决方案

Firstly, you can't do new List(); it is an interface.

To make a list of int Arrays, do something like this :

List<int[]> myList = new ArrayList<int[]>();

这篇关于Java中的数组列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆