English 中文(简体)
如何在 Java绘制2D地图?
原标题:How to create a 2D map in Java?

我要绘制地图,把两条插图绘制成一个插图。 例如,map[“MainServer”,“Status”] Return “active”。 在 Java这样做的最佳方式是什么。 我是否应该利用包括另一个哈希马普在内的哈希姆普作为其要素?

最佳回答

Having a map to a map means that you are doing a double lookup (semantically and in terms of cost). Is this what you actually want?

你也许可以更好地界定包含X扼杀物的马凯尔语种,并凌驾于他们平等的地位。

更一般而言,如果奶制品具有实际意义或抽象,则通过适当名称的物体代之。

问题回答

如你再次向服务器发送电文,以获得回馈价值。

为什么不创设一个名称和地位的服务器级(以及所有其他次要性质),就把服务器名称绘制为服务器?

然后,你就这样做了。

Server server = map.get(serverName);
return server.getStatus();

我认为,最重要的信息是最终的价值。

I this case the simplest solution is to combine the strings into one single key string map["MainServerStatus"]

如果你想拥有“MainServer”的所有价值,你就可以对所有内容进行消化,并过滤从“MainServer”开始。

这是一个非常基本和简单的解决办法,但如果你不想知道“MainServer”so foten的所有要素,你可以使用。 否则,它会减缓你的申请。

如果奶制品总数很小,则简单:从第一个关键到第二个地图的地图;第二个地图从第二个关键到价值。

如果奶制品的总数很大,则绩效可能很重要。 如果是的话,我就建议了与上述相同的解决办法,但选择了作为你的第一个关键,即最小的预计范围(例如,如果第一个关键是数千个名字之一,而第二个关键是十个预先确定的地位,那么第二个关键是你所研究的第一个关键)。

如果业绩确实如此,则需要设计透明度:使用一个奶类作为单一地图的关键。 (一个奶类足够有用,可以认为,到现在,你已经有了一个很好的写法。)





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签