Results 1 to 3 of 3
- 11-04-2008, 03:49 AM #1Member
- Join Date
- Oct 2008
- Rep Power
how to retrieve values from a vector which contains different datatypes
I have a file which contains some data where ; is the delimiter to separate each individual events.I want to store them in a vector .Right now i have some issues in knowing how to retrieve values from a vector which contains different datatypes.When i tried to retieve data,i have to specify the datatype but my dataset contains characters and integers.So please let me know how to do that.Thanks in advance
Last edited by kumar_gemi; 03-08-2009 at 09:48 AM.
Your vector should contain one data type and one data type only. Perhaps your "events" need to be encapsulated into a class and your Vector (or better the more modern ArrayList) would hold objects of this class.
- 11-09-2008, 10:49 PM #3
Have you read the API doc for the Vector class?
What methods look like they would be used to "store" an element in the Vector? Hint the start with the letter a.
What types will the elements be? String or ???
When you define your Vector you use the Generic form: Vector<type> to allow the compiler to type check and cast the elements as they are added or removed from the Vector.
- By jason-nexFIT-mobileXware in forum CLDC and MIDPReplies: 0Last Post: 09-10-2008, 04:01 AM
- By barryc in forum New To JavaReplies: 1Last Post: 07-09-2008, 05:59 PM
- By on7june in forum New To JavaReplies: 1Last Post: 03-08-2008, 05:57 PM
- By snooze-g in forum Advanced JavaReplies: 0Last Post: 10-02-2007, 07:08 AM
- By katie in forum New To JavaReplies: 1Last Post: 08-06-2007, 10:56 PM