哪个集合最好存储来自多维数组的数据? [英] Which collection is better to store data from multi-dimensional array?
问题描述
我有一个多维数组的字符串
。我愿意将它转换成一些集合类型,这样我可以根据我的愿望添加,删除和插入元素。在数组中,我不能删除在特定位置的元素。
I have a multi-dimensional array of string
. I am willing to convert it into some collection type, so that I can add, remove and insert elements according my wish. In array I can not remove element at particular position.
我需要这样的集合,其中我可以删除特定位置的数据,也能够在任何位置添加数据。
也不要忘记我有多维数组,所以集合也应该能够存储多维数据。
哪个集合适合我的要求?
I need such collection in which I can remove data at particular position, also able to add data at any position.
Also dont forget I have multi-dimension array, so the collection should also able to store multidimensional data.
Which collection will be suitable for my requirments?
推荐答案
ArrayList 应该做你需要的。例如:
ArrayList should do what you need. For instance:
List<List<String>> stringList = new ArrayList<List<String>>(); //A List to store a list of strings
或...
List<String[]> myNumberList = new ArrayList<List<String[]>(); //A List to store arrays of Strings.
这篇关于哪个集合最好存储来自多维数组的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!