Java 错误 java.util.concurrent.ConcurrentHashMap.keySet

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24448723/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 12:16:18  来源:igfitidea点击:

Java error java.util.concurrent.ConcurrentHashMap.keySet

javasmartfoxserver

提问by Reptic

Hey guy's am getting this error: Can you guy's possibly try to fix this? or see whats wrong post a fix or something

嘿伙计们收到了这个错误:你们可以尝试解决这个问题吗?或者看看有什么问题发布修复或其他东西

Thanks alot guy's :)

非常感谢伙计:)

Exception in thread "ExtensionHandler-1" java.lang.NoSuchMethodE
rror: java.util.concurrent.ConcurrentHashMap.keySet()Ljava/util/concurrent/Concu
rrentHashMap$KeySetView;
        at aerivial.requests.aqw.GetAction.process(GetAction.java:196)
        at it.gotoandplay.smartfoxserver.controllers.ExtensionHandler.processEve
nt(ExtensionHandler.java:535)
        at it.gotoandplay.smartfoxserver.controllers.ExtensionHandler.run(Extens
ionHandler.java:344)
        at java.lang.Thread.run(Thread.java:619)

The error Code:

错误代码:

        ConcurrentHashMap tgtBuffDebuffs = (ConcurrentHashMap)userTgt.properties.get(Users.BUFFS_DEBUFFS);

        for (Iterator i = tgtBuffDebuffs.keySet().iterator(); i.hasNext(); ) { int auraId = ((Integer)i.next());
          Aura aura = (Aura)World.instance.auras.get(Integer.valueOf(auraId));
          if ((aura.getDamage() >= 0.0D) && (!aura.getCategory().equals("d"))) {
            damage = (int)(damage * aura.getDamage());
          }
        }

采纳答案by Jens

Looks like you have a library which need java8 and you run under a version lower than 8.

看起来您有一个需要 java8 的库,并且您在低于 8 的版本下运行。

In java 8 the api has changed:

在 Java 8 中,api 发生了变化:

In java 8 the keySet method returned an object

在 java 8 中,keySet 方法返回一个对象

ConcurrentHashMap.KeySetView<K,V>

In java 7

在 Java 7

Set<K>