Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

166
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda