Check match in tail array

@param base
@param index
@param key
@return index if it is complete match. 0 if it is prefix match. negative value if it doesn't match
4933
private int matchTail(int base, int index, String key) {
        int positionInTailArr = base - TAIL_OFFSET;

        int keyLength = key.length();
        for (int i = 0; i < keyLength; i++) {
            if (key.charAt(i) != tailBuffer.get(positionInTailArr + i)) {
                return -1;
            }
        }
        return tailBuffer.get(positionInTailArr + keyLength) == TERMINATING_CHARACTER ? index : 0;
    }
1010484
private boolean keyMatch(String key,LazyNode token){
		if(token.type==LazyNode.EFIELD){
			String field=token.getStringValue();
			return field.equals(key);
		}else{
			// Quickly check the length first
			int length=key.length();
			if(token.endIndex-token.startIndex!=length){
				return false;
			}
			// Now go through the field character for character to compare
			if(token.dirty){
				for(int i=0;i<length;i++){
					char c=key.charAt(i);
					if(c!=token.dirtyBuf.charAt(token.startIndex+i)){
						return false;
					}
				}
			}else{
				for(int i=0;i<length;i++){
					char c=key.charAt(i);
					if(c!=token.cbuf[token.startIndex+i]){
						return false;
					}
				}
			}
			return true;
		}
	}
725429
public boolean containsKey(Object key) {
        Entry tab[] = mTable;

        if (key != null) {
            int hash = key.hashCode();
            int index = (hash & 0x7FFFFFFF) % tab.length;
            for (Entry e = tab[index], prev = null; e != null; e = e.mNext) {
                if (e.getValue() == null) {
                    // Clean up after a cleared Reference.
                    mModCount++;
                    if (prev != null) {
                        prev.mNext = e.mNext;
                    }
                    else {
                        tab[index] = e.mNext;
                    }
                    mCount--;
                }
                else if (e.mHash == hash && key.equals(e.mKey)) {
                    return true;
                }
                else {
                    prev = e;
                }
            }
        }
        else {
            for (Entry e = tab[0], prev = null; e != null; e = e.mNext) {
                if (e.getValue() == null) {
                    // Clean up after a cleared Reference.
                    mModCount++;
                    if (prev != null) {
                        prev.mNext = e.mNext;
                    }
                    else {
                        tab[0] = e.mNext;
                    }
                    mCount--;
                }
                else if (e.mKey == null) {
                    return true;
                }
                else {
                    prev = e;
                }
            }
        }

        return false;
    }
429594
public int indexOfKey(Object key) {
        return key == null ? indexOfNull() : indexOf(key, key.hashCode());
    }
833527
public V get(long key) {
		if (size == 0) {
			return null;
		}
		if (size == 1) {
			int posDiff = compare(key, rootKey);
			if (posDiff == -1) {
				return rootVal;
			}
			return null;
		}
		Node<V> n = root;
		while (true) {
			if (!doesInfixMatch(n, key)) {
				return null;
			}			
			
			//infix matches, so now we check sub-nodes and postfixes
			if (getBit(key, n.posDiff)) {
				if (n.hi != null) {
					n = n.hi;
					continue;
				} 
				if (compare(key, n.hiPost) == -1) {
					return n.hiVal;
				}
			} else {
				if (n.lo != null) {
					n = n.lo;
					continue;
				}
				if (compare(key, n.loPost) == -1) {
					return n.loVal;
				}
			}
			return null;
		}
	}
1104605
function indexForKey (array, key) {
  for (var i = 0; i < array.length; i++) {
    if (array[i]['.key'] === key) {
      return i
    }
  }
  /* istanbul ignore next */
  return -1
}
1036282
private int findIndex(Object key, Object[] array) {
        int length = array.length;
        int index = getModuloHash(key, length);
        int last = (index + length - 1) % length;
        while (index != last) {
            if (array[index] == key || array[index] == null) {
                /*
                 * Found the key, or the next empty spot (which means key is not
                 * in the table)
                 */
                break;
            }
            index = (index + 1) % length;
        }
        return index;
    }
489109
private static int binarySearch(int[] a, int fromIndex, int length, int key)
    {
        int low = fromIndex;
        int high = fromIndex + length - 1;

        while (low <= high)
        {
            int mid = (low + high) >>> 1;
            int midVal = a[mid << 1];

            if (midVal < key)
                low = mid + 1;
            else if (midVal > key)
                high = mid - 1;
            else
                return mid; // key found
        }
        return -(low + 1);  // key not found.
    }
1065268
protected Integer getCorrectIndex(Integer index) {
    Integer size = jsonNode.size();
    Integer newIndex = index;

    // reverse walking through the array
    if(index < 0) {
      newIndex = size + index;
    }

    // the negative index would be greater than the size a second time!
    if(newIndex < 0) {
      throw LOG.indexOutOfBounds(index, size);
    }

    // the index is greater as the actual size
    if(index > size) {
     throw LOG.indexOutOfBounds(index, size);
    }

    return newIndex;
  }
843576
public boolean contains(long key) {
		if (size == 0) {
			return false;
		} 
		if (size == 1) {
			int posDiff = compare(key, rootKey);
			if (posDiff == -1) {
				return true;
			}
			return false;
		}
		Node<V> n = root;
		while (true) {
			if (!doesInfixMatch(n, key)) {
				return false;
			}			
			
			//infix matches, so now we check sub-nodes and postfixes
			if (getBit(key, n.posDiff)) {
				if (n.hi != null) {
					n = n.hi;
					continue;
				} 
				return compare(key,  n.hiPost) == -1;
			} else {
				if (n.lo != null) {
					n = n.lo;
					continue;
				}
				return compare(key,  n.loPost) == -1;
			}
			
		}
	}
1230295
public boolean prefixMatchLists( String[] prefixes, String[] keys )
    {
        // The prefixes are part of the server resources. If none is given,
        // everything matches
        if ( prefixes == null )
        {
            return true;
        }
        // If no os keyes was given, and the server resource is keyed of this,
        // then return false.
        if ( keys == null )
        {
            return false;
        }
        // Check for a match on a key
        for ( String key : keys )
        {
            if ( prefixMatchStringList( prefixes, key ) )
            {
                return true;
            }
        }
        return false;
    }
1145566
public static boolean isSet(Object baseObject, long baseOffset, int index) {
    assert index >= 0 : "index (" + index + ") should >= 0";
    final long mask = 1L << (index & 0x3f);  // mod 64 and shift
    final long wordOffset = baseOffset + (index >> 6) * WORD_SIZE;
    final long word = Platform.getLong(baseObject, wordOffset);
    return (word & mask) != 0;
  }
679738
public MatchIterator get(long key, int hashCode) {
		int bucket = hashCode & numBucketsMask;

		int bucketOffset = bucket << 4;
		MemorySegment segment = buckets[bucketOffset >>> segmentSizeBits];
		int segOffset = bucketOffset & segmentSizeMask;

		while (true) {
			long address = segment.getLong(segOffset + 8);
			if (address != INVALID_ADDRESS) {
				if (segment.getLong(segOffset) == key) {
					return valueIter(address);
				} else {
					bucket = (bucket + 1) & numBucketsMask;
					if (segOffset + 16 < segmentSize) {
						segOffset += 16;
					} else {
						bucketOffset = bucket << 4;
						segOffset = bucketOffset & segmentSizeMask;
						segment = buckets[bucketOffset >>> segmentSizeBits];
					}
				}
			} else {
				return valueIter(INVALID_ADDRESS);
			}
		}
	}
513907
function(key) {
			var idx;
			do {
				idx = this.contents.indexOf(key, idx);
			} while(idx !== -1 && !isEven(idx));
			return idx;
		}
185468
@Override
    public V get(Object key) {
        final int index = key == null ? indexOfNull() : indexOf(key, key.hashCode());
        return index >= 0 ? (V)mArray[(index<<1)+1] : null;
    }
435078
@SuppressWarnings("unchecked")
    public V get(int index) {
	int pos = Arrays.binarySearch(keyIndices, index);
	return (pos >= 0) ? (V)(values[pos]) : null;	
    }
1315262
protected boolean matchesFilter(String key) {
		boolean rets = (null == filterList);
		if (!rets) {
			for (Iterator<String> it = filterList.iterator(); it.hasNext() && !rets;)
				rets = key.startsWith(it.next());
		}
		return rets;

	}