Java Java Data Structures Exploring the Java Collection Framework Sets

Are ArrayLists data structures or classes? can they be both?

That's just the question in the headline, thank you in advance.

1 Answer

michaelcodes
michaelcodes
5,601 Points

Hi there! I am definitely not an expert on this, but from my understanding yes it could be classified as both. The List is an interface, and the ArrayList is one of the implementations of it we use. As with a class we created, we create objects from the ArrayList which have the function of an Array. The list functions with its own set of properties (as opposed to say a Set), which are different structures of data storage. I hope this helps! someone with more experience might have something to add.

Take care and happy coding!

It helped thanks!!