I have problem with creating arraylist.
- Array list is created from splitted String "gh2".
- Idea of program is to create array which will containt only characteristic String.
- After creating Array, by string builder "sb2" I'm trying to create another splitted string,WYNIKI
- When I'm calling back second value from WYNIKI, im gettin gerror about boundexpection...
ArrayList<String> listawynikow = new ArrayList<String>(gh2.length);
for (int i = 0; i < gh2.length; i++) {
if (gh2[i].matches("[0-9]+")) {
listawynikow.add(gh2[i]);
}
}
StringBuilder sb2 = new StringBuilder();
for (int j = 0; j < listawynikow.size(); j++) {
sb2.append(listawynikow.get(j)).append(";").append("\n");
}
String wyniki1 = sb2.toString();
String[] WYNIKI = wyniki1.split(";");
When I'm giving different if condition like for example negation of (!gh2[is].matches) everything is working good. Size of array is 23. When I'm checking String before splitting everything looks proper, and array is not empty.
Aucun commentaire:
Enregistrer un commentaire