[GitHub] [commons-collections] garydgregory commented on a change in pull request #84: [COLLECTIONS 708] Add hashCode method to CollectionUtils

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] [commons-collections] garydgregory commented on a change in pull request #84: [COLLECTIONS 708] Add hashCode method to CollectionUtils

GitBox
garydgregory commented on a change in pull request #84: [COLLECTIONS 708] Add hashCode method to CollectionUtils
URL: https://github.com/apache/commons-collections/pull/84#discussion_r325192668
 
 

 ##########
 File path: src/main/java/org/apache/commons/collections4/CollectionUtils.java
 ##########
 @@ -608,6 +608,33 @@ public static boolean isEqualCollection(final Collection<?> a, final Collection<
 
         return isEqualCollection(collect(a, transformer), collect(b, transformer));
     }
+    
+    /**
+     * Getting the hashCode of Collection through the hash method of Equator.
+     * <p>
+     * If the input collection is null return 1.
+     * </p>
+     *
+     * @param <E>  the element type
+     * @param collection  the input collection
+     * @param equator  the Equator used for generate hashCode
+     * @return the hashCode of Collection through the hash method of Equator
+     */
+    public static <E> int hashCode( final Collection<? extends E> collection,
+                                    final Equator<? super E> equator ) {
+        if ( null == equator ) {
+            throw new NullPointerException( "Equator must not be null." );
+        }
+        if ( null == collection ){
 
 Review comment:
   `){` -> `) {`

----------------------------------------------------------------
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:
[hidden email]


With regards,
Apache Git Services