[英]Sorting ArrayList of ArrayList of double and string by the double in Java
[英]ArrayList<Double> insertion(java)
我應該如何將雙重插入ArrayList的特定部分? 例如,我們有一個ArrayList,其中每個都有10個雙精度值,我們希望將其設為第6位10,我們應該怎么做?
使用ArrayList.set()
方法:
public E set(int index, E element) Replaces the element at the specified position in this list with the specified element.
例如:
list.set(5, new Double(10));
請參閱文檔: http : //docs.oracle.com/javase/1.4.2/docs/api/java/util/ArrayList.html
void add(int index, Object element);
將指定元素插入此列表中的指定位置。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.