views:

45

answers:

2

I'm refactoring some legacy code, and I keep running into this Object. I would like to get more use out of this Class, but I'm having a hard time finding an example of its use that is relevant. So far I only have found javadocs and source code. Does anyone know of a good example out there?

--Update Wow, quick turnaround on those answers. Thank you very much. I did some more digging into the code and the ListOrderedMap is created by org.springframework.jdbc.core.JdbcTemplate.queryForList. So the description in the javadoc, "The results will be mapped to a List (one entry for each row) of Maps (one entry for each column, using the column name as the key)." makes a little more sense to me than the description for ListOrderedMap.

+1  A: 

ListOrderedMap is like a java.util.LinkedHashMap that can be used as a decorator/wrapper class. If you prefer a different Map implementation than HashMap (a reference map, for example) you can add to it the preservation of insertion order.

Michael Brewer-Davis
A: 

I use similar collection (I mean Map with preserved order) for values to display on website in comboBox. Each value has label which is displayed, but it's the value (id) that goes to the server. In HTML it is

<select>
  <option value="">-make your choice-</option>
  <option value="62">SomeLabel</option>
  <option value="25">SomeLabel2</option>
</select>

This values and their labels are retrieved from database already ordered.

I think I don't need to explain why order is important here.

amorfis