@Override public final int matchName(String toMatch) { // Logic here is that it is expected most names to match are intern()ed // anyway; as are (typically) contents. So identity check is likely to // work, just not guaranteed. So do fast checks for primary, secondary here int ix = _hash(toMatch.hashCode(), _mask); if (_names[ix] == toMatch) { return _offsets[ix]; } // check secondary slot int ix2 = (_mask + 1) + (ix >> 1); if (_names[ix2] == toMatch) { return _offsets[ix2]; } return _matchName2(toMatch, ix, ix2); }
protected int _matchSpill(String toMatch) { int ix = (_mask+1); ix += (ix>>1); for (int end = _names.length; ix < end; ++ix) { String name = _names[ix]; if (toMatch.equals(name)) { return _offsets[ix]; } if (name == null) { break; } } return matchSecondary(toMatch); }
private final int _matchName2(String toMatch, int ix, int ix2) { String name = _names[ix]; if (toMatch.equals(name)) { return _offsets[ix]; } if (name != null) { name = _names[ix2]; if (toMatch.equals(name)) { return _offsets[ix2]; } if (name != null) { return _matchSpill(toMatch); } } return matchSecondary(toMatch); }