gpt4 book ai didi

java - 我无法确定数组的类型

转载 作者:行者123 更新时间:2023-11-30 02:26:05 25 4
gpt4 key购买 nike

我的客户端(As3)将此数组发送到我的服务器(Java)函数:

{2={y=16.0, x=17.0}, 1={y=17.0, x=17.0}, 0={y=18.0, x=17.0}}

但我无法确定类型。

我尝试过:String[]、Object[] 等..

服务器端:

 public void MaSuperFonction(Object[] $path){ ... }

客户端:

this.groupedList[0] = {x:this.startX,y:this.startY};
this.groupedList[1] = {x:this.startX,y:this.startY};
this.groupedList[2] = {x:this.startX,y:this.startY};

var path = this.groupedList[0];
if(this.groupedList.length > 1)
{
var i = 1;
while(i < this.groupedList.length)
{
path = path.concat(this.groupedList[i]);
i = i + 1;
}
}
this.nc.call('MaSuperFonction',path);

但没有成功。

Method MaSuperFonction with parameters [{2={y=16.0, x=17.0}, 1={y=17.0, x=17.0}, 0={y=18.0, x=17.0}}] not found

最佳答案

我宁愿说这是一个Map<Integer, Point>> ,其中Point类可以声明为:

class Point {
private Double x;
private Double y;
// getters/setters
}

你应该明白,它是一个key=value对的序列,不能用数组来表示(每个单元格只包含一个元素)。

关于java - 我无法确定数组的类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45659422/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com