Results 1 to 6 of 6
  1. #1
    Bishop609 is offline Member
    Join Date
    Feb 2009
    Posts
    3
    Rep Power
    0

    Default Compare two lists of number - what numbers arent there

    Hi there. I am very new to Java. I would like to make a proggie that takes two lists of numbers, compares them, and tells you what is NOT the same. As in, what numbers from list1 are not in list2. Would it be an array, or something...? Your help is appreciated.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    probably best would be a HashSet or other collection.

  3. #3
    Bishop609 is offline Member
    Join Date
    Feb 2009
    Posts
    3
    Rep Power
    0

    Default

    Quote Originally Posted by Fubarable View Post
    probably best would be a HashSet or other collection.
    Thank you, but I have no idea what that means. :) Thats why I posted in this section.

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    What exactly are the homework requirements here? Did the teacher give a list of what can and can't be used here? Is there a text of the assignment you can post here?

  5. #5
    sirwiggles's Avatar
    sirwiggles is offline Member
    Join Date
    Feb 2009
    Posts
    31
    Rep Power
    0

    Default

    I would just create two arrays.

    Next create a loop which cycles through the arrays and checks if any of the elements are the same..

    Hope this helps.
    They're 10 people in the world, those who speak binary, and those who dont.
    ^ Lame i know, but i can actually count in it nowadays! :eek:

  6. #6
    Bishop609 is offline Member
    Join Date
    Feb 2009
    Posts
    3
    Rep Power
    0

    Default

    Quote Originally Posted by Fubarable View Post
    What exactly are the homework requirements here? Did the teacher give a list of what can and can't be used here? Is there a text of the assignment you can post here?
    Teacher? I administer server clusters. The mapping we use for connectivity uses a huge lists of numbers. When we install the system we do a range, and then we must go through and remove the non needed "node" numbers for efficiency sake. I would like to compare a user defined range, say 1000-8000, against a sorted list of actual node numbers that were copied from excel or somewhere else and pasted - then using some type of class (I think), give me the numbers not needed.

    I know many programs can be used to do this. But I am trying to use Java to do it...cause I am trying to learn Java.

    I do appreciate the help.

Similar Threads

  1. rounding a double in a number of significant numbers
    By rikribbers in forum Advanced Java
    Replies: 2
    Last Post: 10-27-2008, 04:35 PM
  2. trying to add up random numbers into one number
    By pjr5043 in forum New To Java
    Replies: 4
    Last Post: 09-15-2008, 03:20 PM
  3. Compare 5 numbers
    By Snowboardmylife in forum New To Java
    Replies: 5
    Last Post: 04-15-2008, 08:04 PM
  4. Compare lists
    By JavaNoob in forum New To Java
    Replies: 2
    Last Post: 08-08-2007, 04:11 PM
  5. how to compare 2 vector lists?
    By oregon in forum New To Java
    Replies: 2
    Last Post: 07-25-2007, 09:25 PM

Posting Permissions

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