public static void finishCaching() { log.trace("call finishCaching()"); for (final Entry<String,List<String>> auxIndexesE : auxIndexes.entrySet()) { final String tag = auxIndexesE.getKey(); // ex: zh-hans final List<String> auxIndexesL = auxIndexesE.getValue(); log.trace("finishCaching: tag: {}", tag); for (final String auxIndexTag : auxIndexesL) { // ex: auxIndexTag: zh-aux-han2pinyin log.trace("finishCaching: auxIndexTag: {}", auxIndexTag); for (final String searchForTag : searchForTags.get(auxIndexTag)) { // ex: zh-latn-pinyin final Hashtable<String,String> res = effectiveFields.computeIfAbsent(tag, x -> new Hashtable<String,String>()); log.trace("add effectiveField mapping: d:{} + q:{} = e:{}", tag, searchForTag, auxIndexTag); res.put(searchForTag, auxIndexTag); } } } }
/** * @param type Type */ private static void storeType(final Type type) { final String className = type.getClass().getName(); final Hashtable<Integer, Type> values; synchronized (types) { values = types.computeIfAbsent(className, k -> new Hashtable<>()); } values.put(type.getValue(), type); }
public static void finishCaching() { log.trace("call finishCaching()"); for (final Entry<String,List<String>> auxIndexesE : auxIndexes.entrySet()) { final String tag = auxIndexesE.getKey(); // ex: zh-hans final List<String> auxIndexesL = auxIndexesE.getValue(); log.trace("finishCaching: tag: {}", tag); for (final String auxIndexTag : auxIndexesL) { // ex: auxIndexTag: zh-aux-han2pinyin log.trace("finishCaching: auxIndexTag: {}", auxIndexTag); for (final String searchForTag : searchForTags.get(auxIndexTag)) { // ex: zh-latn-pinyin final Hashtable<String,String> res = effectiveFields.computeIfAbsent(tag, x -> new Hashtable<String,String>()); log.trace("add effectiveField mapping: d:{} + q:{} = e:{}", tag, searchForTag, auxIndexTag); res.put(searchForTag, auxIndexTag); } } } }
private Hashtable<String, List<String>> getLowlevelGVs(Document document) { Hashtable<String, List<String>> result = new Hashtable<>(); Element gvlist = document.getElementById("GV"); NodeList gvs = gvlist.getChildNodes(); int len = gvs.getLength(); StringBuilder type = new StringBuilder(); for (int i = 0; i < len; i++) { Node gvref = gvs.item(i); if (gvref.getNodeType() == Node.ELEMENT_NODE) { type.setLength(0); type.append(((Element) gvref).getAttribute("type")); int pos = type.length() - 1; char ch; while ((ch = type.charAt(pos)) >= '0' && ch <= '9') { pos--; } String gvname = type.substring(0, pos + 1); List<String> entry = result.computeIfAbsent(gvname, k -> new ArrayList<>()); entry.add(type.substring(pos + 1)); } } return result; }
@Override public synchronized V computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction) { // Must trigger add events if tracked or uow. if (hasTrackedPropertyChangeListener()) { V oldValue = get(key); if (oldValue == null) { V newValue = mappingFunction.apply(key); if (newValue != null) { put(key, newValue); } return newValue; } return oldValue; } return getDelegate().computeIfAbsent(key, mappingFunction); }
@Override public synchronized V computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction) { // Must trigger add events if tracked or uow. if (hasTrackedPropertyChangeListener()) { V oldValue = get(key); if (oldValue == null) { V newValue = mappingFunction.apply(key); if (newValue != null) { put(key, newValue); } return newValue; } return oldValue; } return getDelegate().computeIfAbsent(key, mappingFunction); }
@Test(expected = ReactiveAuditException.class) public void computeIfAbsent() { ReactiveAudit.off.commit(); Hashtable hash=new Hashtable(); TestTools.strict.commit(); hash.computeIfAbsent(null,null); } @Test(expected = ReactiveAuditException.class)