Which Java collection is best suited for LIFO (Last-In-First-Out) stack operations?

Java Associate Medium

Java Associate — Medium

Which Java collection is best suited for LIFO (Last-In-First-Out) stack operations?

Key points

  • ArrayDeque supports both stack and queue operations
  • LinkedList used as a Queue is better for FIFO operations
  • Vector is synchronized, making it slower for stack operations
  • TreeMap is not a suitable choice for LIFO stack operations

Ready to go further?

Related questions