android - ArrayList remove(0) when size > 0 -


i trying first item in arraylist items using items.remove(0), works fine till items.size() 1, @ point code below returns empty string. tired 2 different ways not know why returning "" when expect return last remaining item when items.size > 0. step on using android studio, debugger steps on both return lines in second code. never seen before. please solve this.
thank you

        string item = "";     if (items.size() > 0) {         item =  items.remove(0);     }     return item;       if (items.size() > 0) {         return items.remove(0);     } else {         return "";     } 

why not use .get() method?

string item = "b" // items.size() = 1 if(items.size() > 0) {    item = items.get(0); } else {     item = ""; } 

Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -