If you want order, you should use an ArrayList or a sorted Set.

On Dec 29, 5:25 am, raphael couturier <[email protected]>
wrote:
> Hi,
>
> I have a problem with the hashset implementation because the followinf
> little part of my code uses it and doesn't give the same result
> according to the version of android.
>
> Here is my code :
> HashSet<String> hset=new HashSet<String>();
> hset.add(new String("cat"));
> hset.add(new String("dog"));
> hset.add(new String("youpi"));
> hset.add(new String("argh"));
> hset.add(new String("cat"));
> hset.add(new String("why"));
> hset.add(new String("dummmy"));
>
> for(String s:hset)
>   Log.v("test",s);
>
> with android 1.5 I obtain :
>
> argh
> cat
> why
> youpi
> dog
> dummmy
>
> whereas with android 2.0 I obtain
> argh
> youpi
> cat
> dummmy
> dog
> why
>
> Does anyone have any idea of the problem?
>
> Thanks in advance
> Raphaël

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to