8. Arrays
Programming Project 2021/22

8.5. Limitations

Although arrays are very efficient lightweight data types, they have several limitations we should be aware of:

  1. They can hold only single-type objects
  2. They have fixed length
  3. They offer us limited functionality
    • set-at-index,
    • get-at-index and
    • length

In many cases, we need more sophisticated data structures to help us solve our programming problems, such as:

  • Arrays that can grow and shrink dynamically
  • Queues
  • Stacks
  • Sets
  • Maps
  • Trees
  • Graphs

For those, we can rely on the Java Collections API, which we will see in the following module.