Get map values by by row or key

I need to get linked map values by row or key.

Row numbers are sequential and simply correspond to order the values inserted into map.

An example:

ROW...KEY......VALUE

======================

0.....GOOG.....GOOGLE

1.....SUNW.....SUN

2.....ORCL.....ORACLE

/* Get value by key */

get("GOOG") ="GOOGLE";

get("SUNW") ="SUN";

/* Get value by row */

get(0) ="GOOGLE";

get(1) ="SUN";

get(2) ="ORACLE";

What is a good clean method to implement this? Should I just use 2 maps, one with a ROW-KEY mapping? Thanks.

[842 byte] By [javvvaa] at [2007-10-2 17:29:43]
# 1
If getting by row index doesn't have to be constant or O(log N) time, java.util.LinkedHashMap will do.
pm_kirkhama at 2007-7-13 18:46:26 > top of Java-index,Other Topics,Algorithms...