cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From skolbac...@apache.org
Subject cayenne git commit: fix: replace Java8 code with Java7
Date Thu, 22 Oct 2015 10:54:44 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master 8f2cc7fcc -> 456f41c5e


fix: replace Java8 code with Java7


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/456f41c5
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/456f41c5
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/456f41c5

Branch: refs/heads/master
Commit: 456f41c5e5f1bf90c730c83808073e3d2f5d627e
Parents: 8f2cc7f
Author: Savva Kolbachev <s.kolbachev@gmail.com>
Authored: Thu Oct 22 13:54:19 2015 +0300
Committer: Savva Kolbachev <s.kolbachev@gmail.com>
Committed: Thu Oct 22 13:54:19 2015 +0300

----------------------------------------------------------------------
 .../src/main/java/org/apache/cayenne/di/DIGraph.java     | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/456f41c5/cayenne-di/src/main/java/org/apache/cayenne/di/DIGraph.java
----------------------------------------------------------------------
diff --git a/cayenne-di/src/main/java/org/apache/cayenne/di/DIGraph.java b/cayenne-di/src/main/java/org/apache/cayenne/di/DIGraph.java
index 7712d55..226cd48 100644
--- a/cayenne-di/src/main/java/org/apache/cayenne/di/DIGraph.java
+++ b/cayenne-di/src/main/java/org/apache/cayenne/di/DIGraph.java
@@ -103,10 +103,13 @@ public class DIGraph<V> {
     public Map<V, Integer> inDegree() {
         Map<V, Integer> result = new LinkedHashMap<>();
 
-        for (Map.Entry<V, List<V>> entry : neighbors.entrySet()) {
-            result.putIfAbsent(entry.getKey(), 0);
-            for (V to : entry.getValue()) {
-                result.put(to, result.getOrDefault(to, 0) + 1);
+        for (V v: neighbors.keySet()) {
+            result.put(v, 0);
+        }
+
+        for (V from: neighbors.keySet()) {
+            for (V to: neighbors.get(from)) {
+                result.put(to, result.get(to) + 1);
             }
         }
 


Mime
View raw message