Java K3 Example

Introduction

The java k3 example is extracted from the most popular open source projects, you can refer to the following example for usage.

Programming language: Java

Class/type: K3

Example#1
File: HashedQuaternaryKeyMap.javaProject: heuermh/dishevelled

 /**
  * Return true if the keys in the specified entry are equal to the specified keys.
  *
  * @param entry entry
  * @param key1 first key
  * @param key2 second key
  * @param key3 third key
  * @param key4 fourth key
  * @return true if the keys in the specified entry are equal to the specified keys
  */
 private boolean isEqualKey(
     final HashEntry<QuaternaryKey<K1, K2, K3, K4>, V> entry,
     final K1 key1,
     final K2 key2,
     final K3 key3,
     final K4 key4) {
   QuaternaryKey<K1, K2, K3, K4> key = entry.getKey();
   return (key1 == null ? key.getFirstKey() == null : key1.equals(key.getFirstKey()))
       && (key2 == null ? key.getSecondKey() == null : key2.equals(key.getSecondKey()))
       && (key3 == null ? key.getThirdKey() == null : key3.equals(key.getThirdKey()))
       && (key4 == null ? key.getFourthKey() == null : key4.equals(key.getFourthKey()));
 }

Example#2
File: HashedQuaternaryKeyMap.javaProject: heuermh/dishevelled

 /**
  * Hash the specified keys.
  *
  * @param key1 first key
  * @param key2 second key
  * @param key3 third key
  * @param key4 fourth key
  * @return hash code for the specified keys
  */
 private int hash(final K1 key1, final K2 key2, final K3 key3, final K4 key4) {
   int h = 0;
   if (key1 != null) {
     h ^= key1.hashCode();
   }
   if (key2 != null) {
     h ^= key2.hashCode();
   }
   if (key3 != null) {
     h ^= key3.hashCode();
   }
   if (key4 != null) {
     h ^= key4.hashCode();
   }
   h += ~(h << 9);
   h ^= (h >>> 14);
   h += (h << 4);
   h ^= (h >>> 10);
   return h;
 }