Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Best List Implementation To Represent An Organization Tree

 
Jason Ferguson
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an organization tree with a single top level. The top level can have any number of children, the children can have any number of children, etc.

The question is: which List implementation is better here? If I know the organization tree will stay relatively small and won't change too often, the ArrayList is a better choice. If I know the tree might be quite large or might change fairly often, would LinkedList be a better choice?
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12097
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why use a list for tree structure at all? Why not some kind of, i dunno, TREE structure?
 
Jason Ferguson
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using Hibernate (mostly Criteria) queries to retrieve the data. The methods of the Criteria object return List. I'm not going to rip out all of my database access code for one Use Case.

Originally posted by Fred Rosenberger:
why use a list for tree structure at all? Why not some kind of, i dunno, TREE structure?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic