r/javahelp • • May 07 '20

Codeless Java Developers: what are the common data structures you usually use on production

To professional java dev here, what are the common data structure youve been using and which data structure you strongly suggest for beginners, like me, to study carefully

40 Upvotes

38 comments sorted by

View all comments

3

u/Orbitaliser May 07 '20

All of the collection framework. You want to learn the inheritance hierarchy and use interface types as parameters/declarations as often as possible.

List<String> strings = new ArrayList<>();

So you can swap between the implementations as required. Only use a specific structure if you need a specific feature in one of the subclasses e.g. TreeSet#tailSet but always start as general as possible.

Learn generics thoroughly as well so you know how to make your own customised structure if the need arises.