Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Vector and file read problem

 
vivek sivakumar
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well i have a file say list.ini and following are the contents (contents might grow also..)
10002
10009
30000
40000
500000
600000
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?
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
Thomas Smets
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's not reading into a Vector but it is very close ! See this
Thomas,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic