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!!!

01-03-2011, 08:47 PM

KevinWorkman

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.

01-03-2011, 08:55 PM

lilika

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!

01-03-2011, 09:14 PM

JeanNoel 53

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

01-03-2011, 09:19 PM

lilika

Quote:

Originally Posted by JeanNoel 53

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)

01-03-2011, 09:57 PM

JeanNoel 53

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

01-03-2011, 10:03 PM

lilika

Quote:

Originally Posted by JeanNoel 53

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)?

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

01-03-2011, 10:49 PM

lilika

Quote:

Originally Posted by doWhile

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!!

01-04-2011, 09:23 AM

JeanNoel 53

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.

01-04-2011, 03:05 PM

lilika

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)