java - Three column Data Structure -


i want have small data structure resembles relational db table 3 columns. in fact, it's matrix want select value third column when first 2 match e.g.

edit: formatted

michael john 1 michael jeremy 3 jeremy john 4

and want select 3 when the names of 2 persons (according data selected)

michael , jeremy.

i not want keep in dbms since data 2 small (between (between 20 - 30 rows), want keep configurable allow modifications - such avoiding use java data structure such map / list

i using spring framework.

any suggestions?

in fact, in memory representation of data structure going map. key or hash going combination of user names in both directions , value number.

so map have entries this:

 {"jeremy_john":4}  {"john_jeremy":4} 

of course can use separator. , depending on use case, may not have hash in both directions.

by configurable, i'm assuming mean editable in spring config file. could load list bean constructor this:

<list>               <value>"jeremy,john,4"</value> </list> 

then parse strings in constructor create map. map have 2 entries per line: john, jeremy , reverse.

if did that, keep data in external csv file.

there lot of possibilities including using generics properties or special class wraps each entry. have constructor accepts 2 strings , number. have list of in spring file.

people use pattern use spring low-fi business rules engine.


Comments