gpt4 book ai didi

java - 类型不匹配 : cannot convert from element type Object to List

转载 作者:行者123 更新时间:2023-12-02 11:16:04 24 4
gpt4 key购买 nike

我收到此错误:“类型不匹配:无法从“subLists”中的元素类型对象转换为列表”“并且类型不匹配:无法从元素类型对象转换为字符串”“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 中的对象类型,你需要,程序不会猜测:

List<List<String>> subLists = new ArrayList<>();  

for (List<String> accList : subLists) {
service.submit(() -> {
for (String account : accList) {
// ...

另外,最好使用InterfacesImplementations存储变量,更容易更新( List<List<String>> rather than ArrayList<List<String>>

关于java - 类型不匹配 : cannot convert from element type Object to List,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50281732/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com