在寻找最佳办法搜索 Java稿中的一系列物体(单体字似乎是一种迭加功能)的同时,我来了,这一职位“上”似乎确实是这样做的leg。
但 我有一些问题:
- Javascript doesn t have associative arrays. These seems like one. What gives?
- This seems like a very elegant solution but how does it stack up against the competition?
- "Pass the array and comparison function" - means several specific comparison functions for various searches.
- "Optimised findByX functions" - means optimised searches for each type needed.
- "scalalala method" - which I suspect would be the slowest but most elegant.
另外,你将如何从日本宇宙航空研究开发机构接手,并建立一个结构类似的阵列? 大多数辅导员手脚,并推出实例,以显示阵列的关联性,但无法实际使用。
使用这种方法是否有任何陷阱?
以下链接将受到欢迎(beyond this)。
感谢。
UPDATE: This is what I am having trouble with. If I have data coming back from the server similar to this:
$.getJSON("map.php?jsoncallback=?", function(data) {
for (var x=0,xx=data.stars.length; x<xx; x++) {
stars.push(
new Star(
data.stars[x].id,
data.stars[x].xpos, data.stars[x].ypos,
data.stars[x].name, data.stars[x].owner
)
);
}
});
在星号为一类的情况下:
function Star(id, x, y, n, o) {
this.id = id;
this.x = x; this.y = y;
this.name = n; this.owner = o;
}
www.un.org/Depts/DGACM/index_spanish.htm 因此,我如何把它变成“联系”风格阵列?