我努力使讀數成爲此代碼工作的正確類型。我無法弄清楚如何克服這個錯誤。 There is a bug associated with it,但我不確定這與我是否相關。獲取不兼容的類型和數組所需的錯誤
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]);
}
它顯示錯誤:
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
謝謝你,這工作。 –