Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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,604 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!!