把你的put 和get时的键值都用相同的数组不就可以了吗,
象这样(假设键值是String型):
String[] straMyKeys = { "key1",
           "key2",
           "key3"};
///////////put:
//.....suppose objn inited before!
hstInitedBefore.put(obj1,straMyKeys[0]);
hstInitedBefore.put(obj2,straMyKeys[1]);
hstInitedBefore.put(obj3,straMyKeys[2]);//......////////get:
hstInitedBefore.get(straMyKeys[0]);
hstInitedBefore.get(straMyKeys[1]);
hstInitedBefore.get(straMyKeys[2]);
//....
如果实在还需要处理什么顺序,就处理straMyKeys好了。
供参考!

解决方案 »

  1.   

    透明的方法缺少一般性你可以增加一个ArrayList之类的,专门用于按顺序记录put的关键字
    取出的时候参照ArrayList中的顺序就能达到你的要求了
      

  2.   

    老大,用hashtable主要就是为了避免使用数组必须事先确定维数等等限制啊
      

  3.   

    Hashtable好象是无序的吧,就是因为无序所以要求有键-值(Key-Value)对,取值时是根据键名来取值的。如果要使用有序的话可以使用Vector啊。