Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

164
Views
Java ArrayList<String[]>

I would like to create a 2D array named employees where I know the number of columns (fixed 5 and represent employee's data) but number of rows is somewhat dynamic. So I did something like this:

static ArrayList<String[]> employees = new ArrayList<String[]>();

I figured how to add employees but I can't figure out how to get a specific data out of one employee only, using .get() for example.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

get would return a row, which is a String[]. If you want a specific value from it, you'll have to subscript it using the [] operator:

String specificData = employees.get(1)[2]; // Or any other indexes
over 4 years ago · Santiago Trujillo Report

0

the first dimension which is any ArrayList you have to call by get() method to access and then the returned value is an array which you cann access by index:

ArrayList<String[]> employees = new ArrayList<String[]>();
employees.add(new String[] {"a", "b"});
System.out.println(employees.get(0)[0]);
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!