This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Java in General and the fly likes Vector and file read problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Vector and file read problem" Watch "Vector and file read problem" New topic

Vector and file read problem

vivek sivakumar
Ranch Hand

Joined: Aug 09, 2001
Posts: 187
well i have a file say list.ini and following are the contents (contents might grow also..)
so my problem i need to read these values from this file and store it in a vector!!!pls give me an idea on how to do it?

SCJP, SCWD <br />A farmer learns more from a bad harvest than a good one.
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1506
Since a vector is declared to hold objects, you have to convert each of them to an object first. If your numbers are ints, convert them to an Integer, if they are longs converts them to Long.
You can just wrap them like this...
Long aLong = new Long(yourNumber)

So much trouble in the world -- Bob Marley
Thomas Smets
Ranch Hand

Joined: Dec 11, 2001
Posts: 111
It's not reading into a Vector but it is very close ! See this

Thomas Smets
Just another developper
I agree. Here's the link:
subject: Vector and file read problem
Similar Threads
Writing to a file on the server whose URL is given
idea for this pls?!
struggling with vectors
Error in Servlet compilation
How do I write contents of a vector to file?