[Solved] ArrayList strange behaviour [closed]


Your arraylist is a static variable inside your class.So there is only one arraylist in memory.Each time you call the song method , you are modifying the same list.That means your latest_songs,top_songs,hit_songs, all will be pointing to same list.That is the reason your list is getting over ridden.
Try creating a list inside your method and return it rather than going for static variables.

3

solved ArrayList strange behaviour [closed]