Results 1 to 13 of 13
  1. #1
    lilika is offline Member
    Join Date
    Jan 2011
    Posts
    7
    Rep Power
    0

    Default Array Lists help!!

    Hello everybody!

    I am new to java and i have a problem. I need to create an arraylist from the coordinates οφ the real and estimated values that I have read from a file.But i can't seem to do that! Can you help me please??

    I woul really appreciate your help cause i m lost!!!
    Last edited by lilika; 01-06-2011 at 06:50 AM.

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,939
    Rep Power
    8

    Default

    What happens differently from what you were expecting? Do you get an Exception? Strange results?

    Step through your program with a debugger to see where the program behavior differs from what you'd expect.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    lilika is offline Member
    Join Date
    Jan 2011
    Posts
    7
    Rep Power
    0

    Default

    I cant make the array list. My result from reading the file are ok..But i can't create an array list with the integers from my file. There are no strange results...but i can't go any further for the time...
    Could someone tell me how (and where) to put the code for the array list?

    Thank you for your answer!

  4. #4
    JeanNoel 53 is offline Member
    Join Date
    Dec 2010
    Posts
    5
    Rep Power
    0

    Default

    I have not seen any point on which the arrayLisdt is filled. e.g; using myArrayList.add(myData)

  5. #5
    lilika is offline Member
    Join Date
    Jan 2011
    Posts
    7
    Rep Power
    0

    Default

    Quote Originally Posted by JeanNoel 53 View Post
    I have not seen any point on which the arrayLisdt is filled. e.g; using myArrayList.add(myData)
    Thats exactly what i can't do. i ve googled it and tried everything but i don't know where to put the add function and in what way will it read my coordinates (Real X, Real Y, Received X, Received Y)

  6. #6
    JeanNoel 53 is offline Member
    Join Date
    Dec 2010
    Posts
    5
    Rep Power
    0

    Smile as far I comprise

    il put the add in the while loop after each time you get the X Y,.. and the you add it in the list
    No problemen with the ArrayList for a int as you write Integer

  7. #7
    lilika is offline Member
    Join Date
    Jan 2011
    Posts
    7
    Rep Power
    0

    Default

    Quote Originally Posted by JeanNoel 53 View Post
    il put the add in the while loop after each time you get the X Y,.. and the you add it in the list
    No problemen with the ArrayList for a int as you write Integer
    Ok i can understand that. But what will be my data in the command myArrayList.add(myData)?

    RealX?Real Y?Received X, Received Y? Or something else??

    Thank you!

  8. #8
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

    Default

    Cross posted at the Java Programming Forums

  9. #9
    lilika is offline Member
    Join Date
    Jan 2011
    Posts
    7
    Rep Power
    0

    Default

    Is that a problem? I didn't know that.

  10. #10
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

    Default

    The same conversation and information provided might be going on in both locations. Providing a link between cross-posts makes contributors aware of this, and not spend their time rehashing an issue that has been addressed/answered/etc... elsewhere. See Be Forthright when Cross Posting

  11. #11
    lilika is offline Member
    Join Date
    Jan 2011
    Posts
    7
    Rep Power
    0

    Default

    Quote Originally Posted by doWhile View Post
    The same conversation and information provided might be going on in both locations. Providing a link between cross-posts makes contributors aware of this, and not spend their time rehashing an issue that has been addressed/answered/etc... elsewhere. See Be Forthright when Cross Posting
    Ok Thank you!!

  12. #12
    JeanNoel 53 is offline Member
    Join Date
    Dec 2010
    Posts
    5
    Rep Power
    0

    Default

    either you have a class to gather your 4 integer and you will push (add) the class in the list. In this case you have to change the prototype of the ArrayList
    or you can add 4 time the integers in a dedicated order to get it in the same order.

  13. #13
    lilika is offline Member
    Join Date
    Jan 2011
    Posts
    7
    Rep Power
    0

    Default

    Thank you so much. I managed to do that. Now that I made the array list, i have to loop throught it in order to calculate some averages. But i don't want the average of all the array list but from some specific numbers( which are in specific places)

    ex. A B C D E F G H I J K L ....

    I need the average of C+G+K+....+/ how many are they.

Similar Threads

  1. Array Lists and Club class
    By amekjian in forum New To Java
    Replies: 13
    Last Post: 11-03-2010, 12:42 AM
  2. Help with lists
    By datreta in forum New To Java
    Replies: 6
    Last Post: 10-29-2010, 11:33 AM
  3. Help with arrays and array lists
    By ambernicole88 in forum New To Java
    Replies: 3
    Last Post: 12-04-2009, 09:47 PM
  4. null point exception in array lists
    By c_walker in forum New To Java
    Replies: 3
    Last Post: 10-17-2009, 05:38 AM
  5. please i need the code of comparing these two array lists.
    By raj reddy in forum JavaServer Pages (JSP) and JSTL
    Replies: 5
    Last Post: 04-18-2008, 07:42 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
  •