public JsonSerializerMap(Map<TypeKey, JsonSerializer<Object>> serializers) {
   int size = findSize(serializers.size());
   _size = size;
   int hashMask = (size - 1);
   Bucket[] buckets = new Bucket[size];
   for (Map.Entry<TypeKey, JsonSerializer<Object>> entry : serializers.entrySet()) {
     TypeKey key = entry.getKey();
     int index = key.hashCode() & hashMask;
     buckets[index] = new Bucket(buckets[index], key, entry.getValue());
   }
   _buckets = buckets;
 }
 public JsonSerializer<Object> find(TypeKey key) {
   int index = key.hashCode() & (_buckets.length - 1);
   Bucket bucket = _buckets[index];
   /* Ok let's actually try unrolling loop slightly as this shows up in profiler;
    * and also because in vast majority of cases first entry is either null
    * or matches.
    */
   if (bucket == null) {
     return null;
   }
   if (key.equals(bucket.key)) {
     return bucket.value;
   }
   while ((bucket = bucket.next) != null) {
     if (key.equals(bucket.key)) {
       return bucket.value;
     }
   }
   return null;
 }