comparing two arrays of integers.

Discussion in 'Java' started by Nag, Jun 23, 2005.

  1. Nag

    Nag Guest

    Hi,
    I have two arrays of integers. i need to compare each element of one
    array with each element of another array.
    say..one master list, from 1 to 100 in one array.
    and another list, from 20 to 40 in another array.
    After comparision of two arrays, it should return a another arraylist
    which should contain only 1 to 19 and 41 to 100.

    how to do this?
    Thanks for your inputs.
     
    Nag, Jun 23, 2005
    #1
    1. Advertisements

  2. Nag

    Wibble Guest

    Isn't school over yet?
     
    Wibble, Jun 23, 2005
    #2
    1. Advertisements

  3. On 22 Jun 2005 16:38:16 -0700, Nag wrote:

    (snip description)
    If you are having trouble knowing 'where to begin',
    check Patricia Shanahan's advice at..
    <http://home.earthlink.net/~patricia_shanahan/beginner.html>

    Note that a better group for those starting in Java is
    'comp.lang.java.help'.

    HTH
     
    Andrew Thompson, Jun 23, 2005
    #3
  4. Nag

    Nag Guest

    I should have used some java "techie" terms here...
    any how, i got the solution..
    I created two sets of data. and used following method:
    set1.removeAll(set2)..
    removeAll method removes from set1 all of its elements that are
    contained in the specified collection (here set2)...
     
    Nag, Jun 23, 2005
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.