Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8843667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:17:13+00:00 2026-06-14T11:17:13+00:00

I have a simple .csv file with five fields: firstName (string), lastName (string), age

  • 0

I have a simple .csv file with five fields: firstName (string), lastName (string), age (int), gender (char), and priority (int). I need to read this file into a linked list that I already have set up.

My question is this: What would be the simplest way to go about this? I’m not posting specifics, as I’m just looking for general (but simple) ideas; I’d like to figure it out myself. We have not done much more advanced with file I/O than FileReader / FileWriter. The only way I can think of to accomplish this would be to use Scanner to import each line, then use String.split() to split everything into an array, then go through the array and manually pull everything / convert to the proper format (as they’ll all be strings), then insert all at once into the linked list. This seems like an incredibly roundabout way, however.

Is there a simpler way I can accomplish this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T11:17:14+00:00Added an answer on June 14, 2026 at 11:17 am

    Unfortunately, you’ve already found about the easiest solution.

    In general, generic data reading is very uncomfortable in Java because it’s statically typed. Part of the point of CSV, XML, and other data serialization methods is that they’re self-documenting in terms of the structure of the data being defined. In the case of Java, that doesn’t work too well, because the structure has to either be predefined (via a class) or read into a structure so generic it’s almost useless (like a list or key->value map where everything stays a string).

    This isn’t a Java hate-rant, I’m just pointing out that making this particular job easy and intuitive is fundamentally incompatible with Java’s core language features. In a dynamically-typed language like Python, such things are much simpler (and in Python in particular, almost trivial because of the presence of the core csv module) because you can drop any sort of data into an object and it will adapt to fit. Java has to know ahead of time what’s coming, which leads to the awkward verbosity that you’ve discovered.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple 3 column csv file and i need to exctract only
I have a simple 3 column csv file that i need to use python
I have a simple java code that reads text csv file that contains sentences
I have another csv file where I am trying to do a simple word
I need to load a simple .CSV file from JS (That's not the problem
I have a simple scripts to upload csv file and it works . But
I have exported a CSV file from a database. Certain fields are longer text
I have a simple csv file with around 20K+ values separated by commas. When
I have a simple .csv file that has that I want to extract data
I have created a simple form which is loading a csv file with few

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.