[英]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.