List of usage examples for org.apache.lucene.analysis CharArrayMap size
@Override
public int size()
From source file:org.apache.solr.util.TestCharArrayMap.java
License:Apache License
public void doRandom(int iter, boolean ignoreCase) { CharArrayMap map = new CharArrayMap(1, ignoreCase); HashMap hmap = new HashMap(); char[] key;//from w ww.j av a2 s.co m for (int i = 0; i < iter; i++) { int len = r.nextInt(5); key = new char[len]; for (int j = 0; j < key.length; j++) { key[j] = (char) r.nextInt(127); } String keyStr = new String(key); String hmapKey = ignoreCase ? keyStr.toLowerCase() : keyStr; int val = r.nextInt(); Object o1 = map.put(key, val); Object o2 = hmap.put(hmapKey, val); assertEquals(o1, o2); // add it again with the string method assertEquals(val, map.put(keyStr, val)); assertEquals(val, map.get(key, 0, key.length)); assertEquals(val, map.get(key)); assertEquals(val, map.get(keyStr)); assertEquals(hmap.size(), map.size()); } assertEquals(map, hmap); assertEquals(hmap, map); }