CSV Import

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Christopher Smith

    #1

    CSV Import

    Just want to caution you that I'm new to Java.

    I've setup an object to import comma delimited data of type double. I
    browsed the web to find pre-written code, and arrived at a solution that
    imports each record as a HashMap type object, which is stored in an
    ArrayList type object.

    Based on what I read, it looked like the advantage to this method is that
    the ArrayList object will expand automatically to accomodate the size of
    the records to be imported.

    Here's my question...I need to search through the ArrayList to find a
    subset of records corresponding to a particualr group. What's the best way
    to do this?

    Thanks Chris
  • Oliver Wong

    #2
    Re: CSV Import


    "Christophe r Smith" <christopher.sm ith@cablespeed. comwrote in message
    news:vds4na6lnj 4z$.1yad61nz3qo t.dlg@40tude.ne t...
    Just want to caution you that I'm new to Java.
    >
    I've setup an object to import comma delimited data of type double. I
    browsed the web to find pre-written code, and arrived at a solution that
    imports each record as a HashMap type object, which is stored in an
    ArrayList type object.
    >
    Based on what I read, it looked like the advantage to this method is that
    the ArrayList object will expand automatically to accomodate the size of
    the records to be imported.
    >
    Here's my question...I need to search through the ArrayList to find a
    subset of records corresponding to a particualr group. What's the best
    way
    to do this?
    I don't understand how your comma delimited data would fit into a
    HashMap... that said:

    If you data isn't organized in any way (i.e. sorted in some order), then
    there's not much you can do except iterate through each record, and check if
    it matches your criteria.

    Alternatively, you could read it all in, and then sort it in memory, and
    then use the fact that it's sorted to somehow narrow in on your data
    quickly. This would only be worthwhile if you repeated search through the
    arraylist for many different subgroups of records.

    - Oliver

    Comment

    Working...