wood burning stoves 2.0*
The moose likes Java in General and the fly likes getting object but looking value in .data file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "getting object but looking value in .data file" Watch "getting object but looking value in .data file" New topic
Author

getting object but looking value in .data file

Isaac Ferguson
Ranch Hand

Joined: Jun 22, 2012
Posts: 331
Hi

I am reading from a file and setting the data in a List like this



When I retrieve the data I get the object definition instead of the value in the file. How could I get the value in the file?

Thanks
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4167
    
  21

Split returns an array. You will have to either choose which index in the array to add to your list, or iterate over the list to add them all, or convert the array to a List and use List.addAll(), like:


Steve
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: getting object but looking value in .data file
 
Similar Threads
Passing Jave object arrays
How to pick up data in mysql with Java ?
writing in and appending to a file
how to add every entry into a List as an Object
problem using generics jdk1.5 in jsp