adding to an existing array

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • oll3i
    Contributor
    • Mar 2007
    • 679

    #1

    adding to an existing array

    how to add a new element to an existing array?
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by oll3i
    how to add a new element to an existing array?
    If you feel the need to resize an array, better have a look at the ArrayList
    Simple arrays cannot be resized, i.e. if you want to add more elements you
    have to allocate another array (big enough) and copy everything from the old
    to the new array.

    kind regards,

    Jos

    Comment

    • oll3i
      Contributor
      • Mar 2007
      • 679

      #3
      but i can not add arraylist to combobox

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        Originally posted by oll3i
        but i can not add arraylist to combobox
        True, but you can get an ordinary array from an ArrayList. Read the API docs.
        Pay special attention to the overloaded toArray() methods.

        kind regards,

        Jos

        Comment

        Working...