I'm struggling with getting readings to be the correct type for this code to work. I am having trouble figuring out how to get past this error. There is a bug associated with it, but I am not sure if this is relevant to me or not.
List<String> readings = new ArrayList<String>();
Matcher m = Pattern.compile("\\d{3}").matcher(s);
while (m.find()) {
readings.add(m.group());
}
readings = readings.toArray(new String[0]);
for (int i = 0; i < numberOfElectrodes; i++) {
packet[i] = Integer.parseInt(readings[i]);
}
It shows error:
Error:(313, 44) java: incompatible types: no instance(s) of type variable(s) T exist so that T[] conforms to java.util.List
Error:(322, 58) java: array required, but java.util.List found