Android lists processing

view story

http://stackoverflow.com – What's wrong with my code? When I try to separate items with other name than last one, my Android also add element to new list ( s = songs.get(0); lastSong = s.song; temp_songs.add(s); for(int i=0; i<songs.size();i++) { s = songs.get(i); songg = s.song; if(songg != lastSong) { temp_songs.add(s); lastSong = songg; } } For example, I have a sorted list: ABC ABC ABC BCD BCD CDE After processing new list (temp_songs) should be: ABC BCD CDE But instead I get: ABC ABC ABC BCD BCD CDE (HowTos)