是什么原因导致“ java.lang.IllegalArgumentException:没有为键提供值”? [英] What causes "java.lang.IllegalArgumentException: No value supplied for key"?
问题描述
我有形状的代码
(let [{foo :foo} (make-foo)] ...)
此代码有时会发出 java.lang.IllegalArgumentException:没有提供值对于键:{:foo foo:other other}
。
我见过Clojure:java.lang.IllegalArgumentException:未为密钥提供任何值:当我更改了require 时,但是自从程序上一次运行以来,我还没有更改过它。
I've seen Clojure : "java.lang.IllegalArgumentException: No value supplied for key:" when I changed require, however I haven't changed the require of my program since it last worked.
没有为键提供值异常?
推荐答案
当您尝试从奇数创建地图时会发生这种情况键/值条目的数量:最后一个键缺少值。发生这种情况的一种方法是,在分解非地图集合但将其视为地图时,因为这会在将其分解为普通地图之前为您隐式从集合中创建地图。
This happens when you try to create a map from an odd number of key/value entries: the last key is missing a value. One way this can happen is when destructuring a non-map collection but treating it as a map, since this implicitly creates a map from the collection for you before destructuring it as an ordinary map.
这篇关于是什么原因导致“ java.lang.IllegalArgumentException:没有为键提供值”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!