ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Larry Meadors" <larry.mead...@gmail.com>
Subject Re: Result HashMap elemnt order
Date Fri, 04 Jul 2008 12:56:55 GMT
Maps in Java are not ordered.

    public static void main(String[] args) {
        Map m = new HashMap();
        m.put("this", "this");
        m.put("is", "is");
        m.put("a", "a");
        m.put("test", "test");
        for(Object o:m.values()) System.out.println(o);
    }

The output on my box is:

a
is
this
test

Larry


On Fri, Jul 4, 2008 at 6:19 AM, Nicholoz Koka Kiknadze
<kiknadze@gmail.com> wrote:
> Hi,
>
> I get results using resultClass="java.util.HashMap" and I expected that if I
> iterate values of the HashMap the order will correspond to the order in my
> fields. However it does not. Is that normal behavior?
>
> In other words I have 'Select f1, f2, f3 from Blah', and iterating in the
> HashMap values I get something like f2,f1,f3
>
> iBatis version 2.3.0.677.
>
> Tya
>
>

Mime
View raw message