##背景 如有需要在内存进行搜索匹配,可以使用cqengine来对java的集合进行高效检索 ##maven
com.googlecode.cqengine cqengine 2.9.2
##声明及初始化
IndexedCollectiondemos = new ConcurrentIndexedCollection ();demos.addAll(.....);
##设置索引类型
import static com.googlecode.cqengine.query.QueryFactory.attribute;final AttributeNAME = attribute("name", Demo::getName);reportItems.addIndex(SuffixTreeIndex.onAttribute(NAME));
##搜索
import static com.googlecode.cqengine.query.QueryFactory.contains;Queryquery = contains(NAME,key);ResultSet resultSet = demos.retrieve(query);
##doc