• Post Reply Bookmark Topic Watch Topic
  • New Topic

distribute a list in java  RSS feed

 
Shaista shaikh
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have list of 6 Item now i have to print it according to requirment may b it is 2 or 3.
very first it should b print very first 2 / 3 item then rest 2 / 3 Item then so & so
for example list of no is {1,2,4,6,8}
very first it print {1,2} then {4,6} atlast {8}
out put will be :

1,2
4,6
8
 
pascal betz
Ranch Hand
Posts: 547
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
im not sure i understand your question.
You want to print items of a list either in group of 2 or group of 3 items ?
first thing i notice here is that for 2, 3, .... it should always be the same code achieving this print out functionality, then there should be a loop over the elements in the list...
here is something that should get you started... perhaps not the best way and perhaps still has some problems but it gives you an idea...

pseudocode:
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!