You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2019/09/17 14:15:00 UTC
[GitHub] [commons-collections] garydgregory commented on a change in pull
request #84: [COLLECTIONS 708] Add hashCode method to CollectionUtils
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_r325192426
##########
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 ) {
Review comment:
No spaces inside parens please: `if ( foo )` -> `if (foo)`.
----------------------------------------------------------------
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
With regards,
Apache Git Services