[英]Type mismatch: cannot convert from element type Object to List
我收到此錯誤:“ Type mismatch: cannot convert from element type Object to List" in "subLists"
“ Type mismatch: cannot convert from element type Object to String"
在"accList"
碼:
ArrayList subLists = new ArrayList();
for (List accList : subLists) {
service.submit(() -> {
for (String account : accList) {
accounts.remove(account);
String[] split = account.split(":");
String email = split[0];
String password = split[1];
AuthResult result = null;
您沒有指定不同lists
的對象類型,您需lists
,程序不會猜測:
List<List<String>> subLists = new ArrayList<>();
for (List<String> accList : subLists) {
service.submit(() -> {
for (String account : accList) {
// ...
另外,與Implementations
相比,更好地使用Interfaces
來存儲變量,更易於更新( List<List<String>> rather than ArrayList<List<String>>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.