Array Comparisons in Program

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • cmdolcet69

    Array Comparisons in Program

    Currently i write to an arraylist of (n) lenght. After I collect that
    arraylist i have always been dumping the arraylist to a file (excel
    spread). This time however i have been asked to create up to 4
    arrayslist hold there value and compare all 4 array so that they have
    unique values.

    Example logic is below:
    if my first array holds all unique values then i end
    array1(5,6,7,8, 9)

    if my first array doesn't hold unique value i go another round and get
    array2 then compare.
    array1(3,4,5,5, 6,7)
    array2(2,7,7,8, 9,1)
    i would then take array1 and array2 and average them out to get
    another avgarrylist that would hold unique values.


    Can someon please help. How can i do this?

  • Spam Catcher

    #2
    Re: Array Comparisons in Program

    cmdolcet69 <colin_dolcetti @hotmail.comwro te in
    news:1188932147 .397314.143700@ g4g2000hsf.goog legroups.com:
    Can someon please help. How can i do this?
    You could use a hashtable - if you add duplicates into a hashtable you'll
    get an exception.

    Comment

    • cmdolcet69

      #3
      Re: Array Comparisons in Program

      On Sep 4, 3:47 pm, Spam Catcher <spamhoney...@r ogers.comwrote:
      cmdolcet69 <colin_dolce... @hotmail.comwro te innews:11889321 47.397314.14370 0@g4g2000hsf.go oglegroups.com:
      >
      Can someon please help. How can i do this?
      >
      You could use a hashtable - if you add duplicates into a hashtable you'll
      get an exception.

      Can i do it with jsut comparing the arrays, i need the simplest and
      quickest way of doing this.
      i read somthing about an arraylist.sort? How would that work? I want
      sort through my original arraylist and see if any duplicte are in the
      arraylist.

      Comment

      • Spam Catcher

        #4
        Re: Array Comparisons in Program

        cmdolcet69 <colin_dolcetti @hotmail.comwro te in
        news:1188936025 .651569.306470@ 57g2000hsv.goog legroups.com:
        On Sep 4, 3:47 pm, Spam Catcher <spamhoney...@r ogers.comwrote:
        >cmdolcet69 <colin_dolce... @hotmail.comwro te
        >innews:1188932 147.397314.1437 00@g4g2000hsf.g ooglegroups.com :
        >>
        Can someon please help. How can i do this?
        >>
        >You could use a hashtable - if you add duplicates into a hashtable
        >you'll get an exception.
        >
        >
        Can i do it with jsut comparing the arrays, i need the simplest and
        quickest way of doing this.
        Using a hash table is the simplest.
        i read somthing about an arraylist.sort? How would that work? I want
        sort through my original arraylist and see if any duplicte are in the
        arraylist.
        You'll have to compare each element in the list?

        Comment

        • Cor Ligthert[MVP]

          #5
          Re: Array Comparisons in Program

          Hi,

          Assuming that you have version 2005.

          Create a generic list instead of an arraylist, that you can do as well in
          version 2003, however than you need some casting.

          Cor

          "cmdolcet69 " <colin_dolcetti @hotmail.comsch reef in bericht
          news:1188932147 .397314.143700@ g4g2000hsf.goog legroups.com...
          Currently i write to an arraylist of (n) lenght. After I collect that
          arraylist i have always been dumping the arraylist to a file (excel
          spread). This time however i have been asked to create up to 4
          arrayslist hold there value and compare all 4 array so that they have
          unique values.
          >
          Example logic is below:
          if my first array holds all unique values then i end
          array1(5,6,7,8, 9)
          >
          if my first array doesn't hold unique value i go another round and get
          array2 then compare.
          array1(3,4,5,5, 6,7)
          array2(2,7,7,8, 9,1)
          i would then take array1 and array2 and average them out to get
          another avgarrylist that would hold unique values.
          >
          >
          Can someon please help. How can i do this?
          >

          Comment

          Working...