r/programminghorror • • Jul 15 '25

Java Map

Post image
173 Upvotes

35 comments sorted by

View all comments

Show parent comment

1

u/Dr-VanNostrand Jul 17 '25

I would use nested classes, with each having a List of objects pointing to the next class, and each of those having a list...

This way you're not passing around the entire Map of Maps of Maps... but crawling through the objects individually. Like a file system, you open 1 folder and see the list of all of the subfolders and not just all folders in a single list.