java - 语法问题。如何以与我在评论底部填充双精度数组的方式相同的方式填充双精度列表
问题描述
如何填充双列表与我在评论底部填充双数组的方式相同。
byte b;
short s;
int i;
long l;
private List<List<Product>> products = new ArrayList<>();
private Product[][] productsArray = new products[4][5];
public Automat(){
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 5; j++) {
products.get(0).get(j) = new Product(b);
}
}
}
如下图所示,products.get(0).get(j)
被标记为语法错误:
解决方案
您不能将值分配给=
ArrayList 的索引位置。您必须使用arrayListObject.set(index, object)。
例子:
products.get(0).set(j, new Product(b));
希望这可以帮助。祝你好运。
推荐阅读
- geopandas - 如何解决缓冲后质心点坐标精度不足的问题?
- python - statsmodels.stats.power.TTestIndPower.solve_power计算的统计功效与PDF曲线下面积之差
- google-chrome - Chrome中的UserAgent桌面/移动/触摸有什么区别
- sql - 使用relid而不是表名查询表
- .net - 如何从 .NET 程序集或源代码中获取 IDL
- tavern - 将发送的请求保存在 Tavern 的变量中
- unity3d - 无法让旋转天空盒在 v2019.3.15f1 中工作
- javascript - 从 webPart 调用时 Pnp.js 搜索 PrimaryResult 为空,但从 SearchQueryTools 项目正确返回
- python - 如何将行标题添加到以下 matplotlib 代码?
- sankey-diagram - floWeaver 不会从快速教程中绘制基本图表,也不会显示错误消息