I am trying to add multiple values to an array, but it returns a cannot resolve error. Is there any way or work-around here?
for (Map.Entry<String,String> entry : hash.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if(typePHP.equals("TARGET")) {
message += key + " " + value + "t\n";
}else {
message += key + " " + value + "r\n";
}
array.add(Integer.parseInt(key),value,typePHP,gamePHP);
//Heres the error.
}
Here's the error:Cannot resolve method 'add(int, java.lang.String, java.lang.String, java.lang.String)'
I need the single element to store 4 values at once and have an output like {109,40, TYPE, GAME};
arraydoes not haveaddmethod. what is the type ofarray? please mention its declaration.ArrayList<String> array = new ArrayList <>();@Fartab, I can add values to it but I can only add 1 value at a time, I need it to be 4 values at once.