Java language level updates concerning Maps. (#1008)

* Java language level updates concerning Maps.

* Reverts when comments indicated no sync can happen.
This commit is contained in:
Koen De Groote
2017-04-22 15:48:46 +12:00
committed by Rob Bygrave
parent 8432f7b0d5
commit 43408fcb87
15 changed files with 20 additions and 91 deletions
@@ -211,11 +211,7 @@ public class DLoadContext implements LoadContext {
@Override
public ObjectGraphNode getObjectGraphNode(String path) {
ObjectGraphNode node = nodePathMap.get(path);
if (node == null) {
node = createObjectGraphNode(path);
nodePathMap.put(path, node);
}
ObjectGraphNode node = nodePathMap.computeIfAbsent(path, this::createObjectGraphNode);
return node;
}
@@ -284,11 +280,7 @@ public class DLoadContext implements LoadContext {
if (path == null) {
return rootBeanContext;
}
DLoadBeanContext beanContext = beanMap.get(path);
if (beanContext == null) {
beanContext = createBeanContext(path, defaultBatchSize, null);
beanMap.put(path, beanContext);
}
DLoadBeanContext beanContext = beanMap.computeIfAbsent(path, p -> createBeanContext(p, defaultBatchSize, null));
return beanContext;
}
@@ -314,11 +306,7 @@ public class DLoadContext implements LoadContext {
if (path == null) {
throw new RuntimeException("path is null?");
}
DLoadManyContext ctx = manyMap.get(path);
if (ctx == null) {
ctx = createManyContext(path, defaultBatchSize, null);
manyMap.put(path, ctx);
}
DLoadManyContext ctx = manyMap.computeIfAbsent(path, p -> createManyContext(p, defaultBatchSize, null));
return ctx;
}