views:

33

answers:

0

Hi,

I would like to implement a DataSource interface (in Java) which, among other things, allows you to aquire the nextRow() from the data. I initially just want to implement the data store via HashMaps, but it would be cool to abstract away from the underlying data structure, and provide an interface as mentioned.

Does this sound like a good idea? Providing the nextRow() method for the HashMap implementation seems somewhat messy - I guess I need to provide an iterator on the collection view of the data. And I guess I'd need to provide a resetIterator method as well?

To provide a few more details:

  • I am thinking the newRow() method will return HashMap<String, String>
  • HashMap implementation of the data store will be HashMap<String, HashMap<String, String>>

Any thoughts and comments are much appreicated!