This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes How to maintain Parent-Child Data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to maintain Parent-Child Data" Watch "How to maintain Parent-Child Data" New topic

How to maintain Parent-Child Data

deepak kukreja
Ranch Hand

Joined: Aug 13, 2001
Posts: 54
Hi, I want to read data from some table and maintain it in a data structure.
Table o/p is like:

Id Parent Id
-- ---------
1 0
2 0
3 2
4 3
5 2
6 0
7 6
8 6
Here parent id 0 means that node is a parent node.
I want to know the way that I can use to maintain this data in a data structure(HashMap,ArrayList etc.) so that I can read it in my jsp.
As an example data structure should say: for Id number 6 -> 7 and 8 are the children.


Deepak<br />SCJP
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

What have you tried and where are you stuck?

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
I agree. Here's the link:
subject: How to maintain Parent-Child Data
Similar Threads
XML DOM & children nodes
How do i generate dynamic graph in html
Creating JTree On Run TIme
XML Notes -II
I am lost , Help Me Please ...JTree