Java双入门表 [英] Java Double entry table

查看:107
本文介绍了Java双入门表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我需要做这样的事情

  1 2 3 
_______
a | x y z

b | h l m

c | oak

table.get(a,1)将返回 x



当然,它应该使用任何对象作为键,值等



提前感谢

解决方案

有两种基本方法,



一个是使 Hashtable (或类似) Hashtable s。

  Hashtable< Integer,Hashtable< String,String> = ...; 

另一种方法是建立自己的数据类型,表示一个(Integer,String)对, do:

  Hashtable< YourFancyDatatype,String> 


Does anyone know a double entry table implementation in java I can download ?

I need to do something like this

   1  2  3
   _______
a| x  y  z 

b| h  l  m

c| o  a  k

table.get(a,1) would return x

Of course, it should use any Object as key, value, etc

Thanks in advance

解决方案

There are two basic approaches, depending on your needs.

One is to make a Hashtable (or similar) of Hashtables.

Hashtable<Integer, Hashtable<String, String>> = ...;

Another approach is to build your own datatype that represents an (Integer, String) pair, so you can do:

Hashtable<YourFancyDatatype, String>

这篇关于Java双入门表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆