hashset problem

Common bugs/problems with the Android SDK the Emulator and the ADT-Plugin.

hashset problem

Postby raphael.couturier » Tue Dec 29, 2009 12:42 pm

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 :
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. HashSet<String> hset=new HashSet<String>();
  2.  
  3. hset.add(new String("cat"));
  4.  
  5. hset.add(new String("dog"));
  6.  
  7. hset.add(new String("youpi"));
  8.  
  9. hset.add(new String("argh"));
  10.  
  11. hset.add(new String("cat"));
  12.  
  13. hset.add(new String("why"));
  14.  
  15. hset.add(new String("dummmy"));
  16.  
  17.                    
  18.  
  19. for(String s:hset)
  20.  
  21.   Log.v("test",s);
Parsed in 0.033 seconds, using GeSHi 1.0.8.4


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
raphael.couturier
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Dec 29, 2009 12:39 pm

Top

Return to SDK/ADT/Emulator Problems

Who is online

Users browsing this forum: No registered users and 4 guests