Jacksonkr Jacksonkr - 1 year ago 1355
Java Question

java howto ArrayList push, pop, shift, and unshift

I've determined that a Java

is similar to a JavaScript

I'm stuck on finding
functions similar to the following

  • Array.pop

  • Array.shift

  • Array.unshift
    I'm leaning toward

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