You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2020/06/03 02:19:44 UTC

[GitHub] [ignite] nva commented on a change in pull request #7886: IGNITE-13104 Fixed incorrect logic in spring-data repositories for findAllById() and deleteAllById() methods. Code cleanup.

nva commented on a change in pull request #7886:
URL: https://github.com/apache/ignite/pull/7886#discussion_r434270960



##########
File path: modules/spring-data-2.0/src/main/java/org/apache/ignite/springdata20/repository/support/IgniteRepositoryImpl.java
##########
@@ -105,20 +106,39 @@ public IgniteRepositoryImpl(IgniteCache<ID, T> cache) {
         };
     }
 
-    /** {@inheritDoc} */
-    @Override public Iterable<T> findAllById(Iterable<ID> ids) {
+    /**
+     * @param ids Collection of IDs.
+     * @return Collection transformed to set.
+     */
+    private Set<ID> toSet(Iterable<ID> ids) {

Review comment:
       Try something like this
   
   ```
   private Set<ID> toSet(Iterable<ID> ids) {
       if (ids instanceof Set)
           return (Set<ID>)ids;
   
       Iterator<ID> itr = ids.iterator();
   
       if (!itr.hasNext())
           return emptySet();
   
       ID key = itr.next();
   
       Set<ID> keys = key instanceof Comparable ? new TreeSet<>() : new HashSet<>();
   
       keys.add(key);
   
       while (itr.hasNext()) {
           key = itr.next();
   
           keys.add(key);
       }
   
       return keys;
   }
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org