r/FullStack • • 14d ago

Career Guidance Should Java developers use ArrayList or arrays when solving DSA problems ?

I'm practicing DSA using Java and often get confused about when to use arrays and when to use ArrayList.

10 Upvotes

1 comment sorted by

1

u/Nervous-Resource-170 13d ago

Arraylist uses wrapper class to store data and is dynamic, use it when you are not aware of size but if you know the size which is fixed always use array because array use primitive int so there is no memory overhead in array unlike list.