- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当前,当我向 IndexedCollection 添加元素时遇到此错误:
HIGHEST: null
java.lang.NullPointerException
at java.util.concurrent.ConcurrentSkipListMap.doGet(ConcurrentSkipListMap.java:778)
at java.util.concurrent.ConcurrentSkipListMap.get(ConcurrentSkipListMap.java:1546)
at com.googlecode.cqengine.index.support.AbstractMapBasedAttributeIndex.addAll(AbstractMapBasedAttributeIndex.java:81)
at com.googlecode.cqengine.engine.CollectionQueryEngine$12.perform(CollectionQueryEngine.java:1125)
at com.googlecode.cqengine.engine.CollectionQueryEngine.forEachIndexDo(CollectionQueryEngine.java:1206)
at com.googlecode.cqengine.engine.CollectionQueryEngine.addAll(CollectionQueryEngine.java:1122)
at com.googlecode.cqengine.ConcurrentIndexedCollection.add(ConcurrentIndexedCollection.java:351)
我尝试调试以查看是否传递了空值,但没有。我尝试添加的对象有一个 null DateTime
但相应的索引已经返回 null,而不是当它为 null 时。
我认为这个问题的解决最终取决于经验,@npgall 你是否遇到过这个问题,如果有的话你是如何解决的?
最佳答案
我认为网站上缺乏这方面的文档。它提到了 SimpleNullableAttribute
和 MultiValueNullableAttribute
但没有真正解释何时使用它们。
TL;DR是:如果你得到一个NPE,通常意味着你需要使用可为空的属性。
或更准确地说:如果您的数据有可能包含 null 值,那么您需要使用可为 null 的属性(例如 SimpleNullableAttribute
),而不是不可为 null 的属性(例如 SimpleAttribute
)。
无论如何,我已经扩展了主 Readme.md 上的文档更详细地讨论“空值”。希望有帮助!
关于java - cqengine IndexedCollection 添加导致空指针,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40406059/
我有一个应用程序,其底层数据缓存正在使用 CQEngine。它非常快速和可靠。但是,我目前正在研究创建一个可以共享数据的 CQEngine 集群。有人遇到过吗? 最佳答案 (虽然是个老问题..)我没有
我正在尝试查找特定DateTime 之后的对象列表。为此,我创建了以下查询: return foos.retrieve(QueryFactory.equal(EXPIRY_INDEX, new Dat
假设我有 3 个集合: User User_Role Role 我想通过给定的角色名称了解用户,但我需要在 user.id 上加入 user_role 并在 role.id 上加入 user_role
我有一个应用程序需要对数百万个较小的集合应用灵活的查询,每个集合的大小从 10 到 10000 个项目不等。 CQEngine 在提供查询这些集合的灵 active 方面做得很好,但比以前更严格的实现
当前,当我向 IndexedCollection 添加元素时遇到此错误: HIGHEST: null java.lang.NullPointerException at java.util.c
我有一个类 Object1,它有一个称为标签的长整型列表。我有另一个名为tagsToSearch 的多头列表。如何使用 CQEngine 构造如下查询: Select * from Object1 W
我正在考虑 CQEngine对于一个我需要处理大量实时事件并不时执行一些查询的项目。它很适合返回结果,但我注意到集合越大,向其中添加元素或从中删除元素的速度就越慢。 我在集合中添加了一些简单的索引,所
我正在尝试添加一个索引,其中我的覆盖 equals()确定两个对象是否相同。 Car.java public static class Car { final String id;
我正在使用没有特定设置的 cqengine,并且我对 sqllite 有 6MB 的 maven 依赖。 我目前只使用 NavigableIndexes,所以我没有在我的磁盘上写任何东西,不是明确的,
我有配置了 NavigableIndex 的 com.googlecode.cqengine.IndexedCollection 对象。一般来说,我需要从索引或索引的迭代器中获取第一项或最后一项。 我
我正在尝试使用 Scala 的 foreach 处理 CQEngine 的 ResultSet,但结果非常慢。 以下是我正在尝试做的事情的片段 import collection.JavaConver
我有一个表,从中提取 8 列,这些列将是 pojo 的属性,例如 MyPojo。 我想删除重复项。 我想出了两个策略。 1-让 oracle 使用不同的关键字来处理这个问题 select distin
我是一名优秀的程序员,十分优秀!