cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject [2/2] cayenne git commit: Code cleanup
Date Fri, 01 Jun 2018 07:44:19 GMT
Code cleanup


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

Branch: refs/heads/master
Commit: 85805afca6ac26fa725e80c7cefc46b382445976
Parents: bc3acb1
Author: Nikita Timofeev <stariy95@gmail.com>
Authored: Fri Jun 1 10:43:59 2018 +0300
Committer: Nikita Timofeev <stariy95@gmail.com>
Committed: Fri Jun 1 10:43:59 2018 +0300

----------------------------------------------------------------------
 .../java/org/apache/cayenne/map/DbEntity.java     | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/85805afc/cayenne-server/src/main/java/org/apache/cayenne/map/DbEntity.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/map/DbEntity.java b/cayenne-server/src/main/java/org/apache/cayenne/map/DbEntity.java
index c4d8a7d..51fefa4 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/map/DbEntity.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/map/DbEntity.java
@@ -240,13 +240,7 @@ public class DbEntity extends Entity implements ConfigurationNode, DbEntityListe
         if (map != null) {
             for (DbEntity ent : map.getDbEntities()) {
                 for (DbRelationship relationship : ent.getRelationships()) {
-                    Iterator<DbJoin> joins = relationship.getJoins().iterator();
-                    while (joins.hasNext()) {
-                        DbJoin join = joins.next();
-                        if (join.getSource() == attr || join.getTarget() == attr) {
-                            joins.remove();
-                        }
-                    }
+                    relationship.getJoins().removeIf(join -> join.getSource() == attr
|| join.getTarget() == attr);
                 }
             }
         }
@@ -603,7 +597,7 @@ public class DbEntity extends Entity implements ConfigurationNode, DbEntityListe
     }
 
     public Collection<ObjEntity> mappedObjEntities() {
-        Collection<ObjEntity> objEntities = new HashSet<ObjEntity>();
+        Collection<ObjEntity> objEntities = new HashSet<>();
         MappingNamespace mns = getDataMap().getNamespace();
         if (mns != null) {
             for (ObjEntity objEntity : mns.getObjEntities()) {
@@ -675,7 +669,7 @@ public class DbEntity extends Entity implements ConfigurationNode, DbEntityListe
         }
 
         private PathComponentIterator createPathIterator(String path) {
-            return new PathComponentIterator(DbEntity.this, path, new HashMap<String,
String>());
+            return new PathComponentIterator(DbEntity.this, path, new HashMap<>());
             // TODO: do we need aliases here?
         }
 
@@ -705,7 +699,7 @@ public class DbEntity extends Entity implements ConfigurationNode, DbEntityListe
                 Iterator<CayenneMapEntry> relationshipIt = resolvePathComponents(relationshipPath);
 
                 // for inserts from the both ends use LinkedList
-                LinkedList<String> finalPath = new LinkedList<String>();
+                LinkedList<String> finalPath = new LinkedList<>();
 
                 // append remainder of the relationship, reversing it
                 while (relationshipIt.hasNext()) {
@@ -724,7 +718,7 @@ public class DbEntity extends Entity implements ConfigurationNode, DbEntityListe
             // case (1)
             if (path.equals(relationshipPath)) {
 
-                LinkedList<String> finalPath = new LinkedList<String>();
+                LinkedList<String> finalPath = new LinkedList<>();
                 PathComponentIterator pathIt = createPathIterator(path);
 
                 // just do one step back and one step forward to create correct
@@ -756,7 +750,7 @@ public class DbEntity extends Entity implements ConfigurationNode, DbEntityListe
             Iterator<CayenneMapEntry> relationshipIt = resolvePathComponents(relationshipPath);
 
             // for inserts from the both ends use LinkedList
-            LinkedList<String> finalPath = new LinkedList<String>();
+            LinkedList<String> finalPath = new LinkedList<>();
 
             while (relationshipIt.hasNext() && pathIt.hasNext()) {
                 // relationship path components must be DbRelationships


Mime
View raw message