我有一些这样的代码: private final Map<String, Runnable> map = new HashMap<>();}
我将非空函数(a(),b())作为映射值,与字符串配对。我需要运行函数并获取函数的结果,然后在函数c()中返回结果。run()函数返回void,因此我无法从中获取值。有没有办法做到这一点?
目前我正在使用ConcurrentHashMap,并且我非常熟悉HashMap,我期望类似于HashMap的行为,但是当我插入一个null键或值时,ConcurrentHashMap抛出一个NullPointerException我看到了他们的来源,ConcurrentHashMap的片段:public V put(K key, V value) {...
public V put(K key, V