This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Having two lists with that content, what you need to do is:
take the first value from list1 and add it to mainList
take the first value from list2 and add it to mainList
take the second value from list1 and add it to mainList
take the second value from list2 and add it to mainList
take the n-th value from list1 and add it to mainList
take the n-th value from list2 and add it to mainList
Not so hard, right? But nobody's gonna implement that for you, you need to do it yourself.
By the way, I supposed those dashes between should not be part of mainList.
The quieter you are, the more you are able to hear.
Tahir Ahm wrote:Its entering infinite loop, i guess... Taking longer time to load the page.
Frankly, I'm surprised it does anything at all, because what you've written won't compile. When posting code, please make sure it's exact (use copy/paste if you need to; I'd also suggest that you read this page).
However, for your needs, have you considered a Map (java.util.Map) instead?
Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here