This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Collection

 
ronald dsouza
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am calling a webservice which returns me a collection which contains a string like below:
Model1|mdesc|Table1|tdesc|Col1|cdesc
Model1|mdesc|Table2|tdesc|Col1|cdesc
Model1|mdesc|Table1|tdesc|Col2|cdesc
Model1|mdesc|Table2|tdesc|Col2|cdesc
.
.
.


I have to create a list showing how many table's the model has and its columns.
What is the best collection to use here? I might later have to iterate this collection and create a html page so it should be easier to access.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure from your brief description. Have you gone through the different types of collection, which you can find about here?

You might want a List of Lists, but that is not at all certain from your post.
 
ronald dsouza
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Not sure from your brief description. Have you gone through the different types of collection, which you can find about here?

You might want a List of Lists, but that is not at all certain from your post.

Input:
Model1|mdesc|Table1|tdesc1|Col1|cdesc1
Model1|mdesc|Table2|tdesc2|Col1|cdesc2
Model1|mdesc|Table1|tdesc1|Col2|cdesc3
Model1|mdesc|Table2|tdesc2|Col2|cdesc4
.
.
.

The output I except is:
model1
mdesc
Table1
tdesc1
col1
cdesc1
col2
cdesc3
table2
tdesc2
col1
cdesc2
col2
cdesc4

can this be done?
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you can explain how you get from the four lines above to the column below, then you can do it programmatically.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic