Results 1 to 4 of 4

Thread: Iterating multiple collections

Threaded View

  1. #3

    Thread Starter
    Fanatic Member x-ice's Avatar
    Join Date
    Mar 2004
    Location
    UK
    Posts
    671

    Re: Iterating multiple collections

    Quote Originally Posted by ComputerJy
    What is the purpose of this iteration?
    I need to execute the print method of each object in both collections in a specific order. Like this:

    Collection1[1].print()
    Collection2[1].print()
    Collection1[2].print()
    Collection2[2].print()
    Collection1[3].print()
    Collection2[3].print()
    Collection1[4].print()
    Collection2[4].print()

    and so on...

    To be more specific

    I have a dating system (uni coursework) that is meant to match male and female customers. I am doing this the simple (gaining slightly lower marks) way.

    I have two collections :- maleCust and femaleCust, both contain Customer objects.

    I want to match the first male with the first female found in both collections, and so on... I think an iterator would be perfect for this.
    Last edited by x-ice; Dec 12th, 2005 at 09:51 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width