MCPcopy Create free account
hub / github.com/jwtk/jjwt / nullSafeHashCode

Method nullSafeHashCode

api/src/main/java/io/jsonwebtoken/lang/Objects.java:355–389  ·  view source on GitHub ↗

Return as hash code for the given object; typically the value of Object#hashCode() . If the object is an array, this method will delegate to any of the nullSafeHashCode methods for arrays in this class. If the object is null , this method returns 0. @par

(Object obj)

Source from the content-addressed store, hash-verified

353 * @see #nullSafeHashCode(short[])
354 */
355 public static int nullSafeHashCode(Object obj) {
356 if (obj == null) {
357 return 0;
358 }
359 if (obj.getClass().isArray()) {
360 if (obj instanceof Object[]) {
361 return nullSafeHashCode((Object[]) obj);
362 }
363 if (obj instanceof boolean[]) {
364 return nullSafeHashCode((boolean[]) obj);
365 }
366 if (obj instanceof byte[]) {
367 return nullSafeHashCode((byte[]) obj);
368 }
369 if (obj instanceof char[]) {
370 return nullSafeHashCode((char[]) obj);
371 }
372 if (obj instanceof double[]) {
373 return nullSafeHashCode((double[]) obj);
374 }
375 if (obj instanceof float[]) {
376 return nullSafeHashCode((float[]) obj);
377 }
378 if (obj instanceof int[]) {
379 return nullSafeHashCode((int[]) obj);
380 }
381 if (obj instanceof long[]) {
382 return nullSafeHashCode((long[]) obj);
383 }
384 if (obj instanceof short[]) {
385 return nullSafeHashCode((short[]) obj);
386 }
387 }
388 return obj.hashCode();
389 }
390
391 /**
392 * Return a hash code based on the contents of the specified array.

Callers 8

hashCodeMethod · 0.95
hashCodeMethod · 0.95
hashCodeMethod · 0.95
hashCodeMethod · 0.95
hashCodeMethod · 0.95
hashCodeMethod · 0.95
DefaultJwkThumbprintMethod · 0.95
computeHashCodeMethod · 0.95

Calls 2

hashCodeMethod · 0.95
isArrayMethod · 0.80

Tested by

no test coverage detected