Jacksonkr Jacksonkr - 1 year ago 1302
Java Question

java howto ArrayList push, pop, shift, and unshift

I've determined that a Java

ArrayList.add
is similar to a JavaScript
Array.push


I'm stuck on finding
ArrayList
functions similar to the following


  • Array.pop

  • Array.shift

  • Array.unshift
    I'm leaning toward
    ArrayList.remove[At]



The last one is the most important for what I'm working on now (Android). Thanks in advance!

Jon Jon
Answer Source

ArrayList is unique in its naming standards. Here's the equivalencies:

Array.pop     -> ArrayList.remove(int index);
Array.shift   -> ArrayList.remove(0);
Array.unshift -> ArrayList.add(int index, Object o); //Index would be 0