MCPcopy Create free account
hub / github.com/OpenTSDB/asynchbase / memcmpMaybeNull

Method memcmpMaybeNull

src/Bytes.java:608–618  ·  view source on GitHub ↗

memcmp(3) in Java for possibly null arrays, hooray. @param a First possibly null byte array to compare. @param b Second possibly null byte array to compare. @return 0 if the two arrays are identical (or both are null), otherwise the difference between the firs

(final byte[] a, final byte[] b)

Source from the content-addressed store, hash-verified

606 * null} byte array is considered shorter than an empty byte array).
607 */
608 public static int memcmpMaybeNull(final byte[] a, final byte[] b) {
609 if (a == null) {
610 if (b == null) {
611 return 0;
612 }
613 return -1;
614 } else if (b == null) {
615 return 1;
616 }
617 return memcmp(a, b);
618 }
619
620 /** A convenient map keyed with a byte array. */
621 public static final class ByteMap<V> extends TreeMap<byte[], V>

Callers

nothing calls this directly

Calls 1

memcmpMethod · 0.95

Tested by

no test coverage detected