Stack - different implementations in Java