Skip to content

Commit

Permalink
Add hash array computation to Objects
Browse files Browse the repository at this point in the history
  • Loading branch information
aNNiMON committed Jan 9, 2015
1 parent 5ac29e9 commit 80e0fa5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/com/annimon/stream/Objects.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ public static int hashCode(Object o) {
return o != null ? o.hashCode() : 0;
}

public static int hash(Object... values) {
if (values == null) return 0;

int result = 1;
for (Object element : values)
result = 31 * result + hashCode(element);
return result;
}

public static String toString(Object o, String nullDefault) {
return (o != null) ? o.toString() : nullDefault;
}
Expand Down

0 comments on commit 80e0fa5

Please sign in to comment.