Jacksonkr Jacksonkr -5 years ago 1861
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!

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
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download