无法弄清楚为什么 .contains() 不 return 为真,尝试了一切都没有用

Can't figger out why .contains() doesn't return true, tried everything nothing worked

我无法弄清楚为什么 .contains 不 return 当列表为真时:[NGX-CORE, PingAPI] 包含 [PingAPI]

服务器插件 returns: [PingAPI, NGX-CORE] addon.depend returns: [PingAPI]

包含代码:ServerPlugins.contains(addon.depend)

控制台输出:

System.out.println("ServerPlugins contents: " + ServerPlugins);
System.out.println("Addon Dependencies: " + addon.depend);
System.out.println("Is addon.depend empty: " + addon.depend.isEmpty());
System.out.println("Does ServerPlugins contain addon.depend: " + ServerPlugins.contains(addon.depend));
System.out.println("Does ServerPlugins contain addon.depend: " + ServerPlugins.contains(addon.depend.toString()));
if (addon.depend.isEmpty()) {
    if (!(m.disabled.contains(addon.name))) {
        Core.Main.m.registerCommands(commands, addon);
        System.out.println("Add-on " + addon.name + " loaded! v" + addon.version);
        addon.onLoad();
        plugins.add(addon);
        m.enabled.add(addon.name);
    } else {
        System.out.println("Add-on " + addon.name + " is disabled and wasn't loaded!");
    }
} else {
    if (ServerPlugins.contains(addon.depend)) {
        if (!(m.disabled.contains(addon.name))) {
            Core.Main.m.registerCommands(commands, addon);
            System.out.println("Add-on " + addon.name + " loaded! v" + addon.version);
            addon.onLoad();
            plugins.add(addon);
            m.enabled.add(addon.name);
        } else {
            System.out.println("Add-on " + addon.name + " is disabled and wasn't loaded!");
        }
    } else {
        System.out.println("Add-on " + addon.name + " requires other plugins to function, required plugins: " + addon.depend.toString().replace("]", "").replace("[", ""));
    }
}

我需要做的就是:将 .contains 替换为 .containsAll

.contains 查找对象,但不比较对象。然而 .containsAll 看起来以为是一个集合。

感谢 Bram

解决了