commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hasan Diwan <>
Subject Re: [dbutils]
Date Sun, 18 Dec 2011 18:46:38 GMT
On 18 December 2011 10:31, aris2world <> wrote:
> I've a question about CaseInsensitiveHashMap in BasicRowProcessor: it
> extends HashMap but if it will extend LinkedHashMap I think the resulting
> Map could seem more consistent with the executed query to a client
> perspective.
> I mean: when the method toMap puts the columns of the resultset into the
> map, the insertion order is the same of the columns in the select list of
> the executed query. It will be useful to me to extract values in the same
> order when I'm iterating over the key set of the returned map. This is
> accomplished in a simply way with a LinkedHashMap. What do you think about
> it?

I think you should be able to (untested):
HashMap<String, Object> map = basicRowProcessorInstance.toMap();
List <String> keys = new ArrayList(map.keySet());
now keys will be sorted alphabetically by String's default Comparator,
but you can also specify a custom one.

Sent from my mobile device
Envoyait de mon portable

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message