Skip to content

Commit

Permalink
Issue #440: resolves NumericLiteralNeedsUnderscoreCheck
Browse files Browse the repository at this point in the history
  • Loading branch information
rnveach authored and Calixte committed Jan 28, 2023
1 parent a4d5bc5 commit 1b2d9d8
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ public Enumeration<?> elements() {
* @return the value associated with the specified key, null if the specified key does not exist
*/
public Object get(Object key) {
int index = (hashCode(key) & 0x7FFFFFFF) % elementData.length;
int index = (hashCode(key) & 0x7F_FFF_FFF) % elementData.length;
HashMapEntry entry = elementData[index];
while (entry != null) {
if (keyEquals(key, entry.key)) {
Expand All @@ -618,7 +618,7 @@ public Object get(Object key) {
}

private HashMapEntry getEntry(Object key) {
int index = (hashCode(key) & 0x7FFFFFFF) % elementData.length;
int index = (hashCode(key) & 0x7F_FFF_FFF) % elementData.length;
HashMapEntry entry = elementData[index];
while (entry != null) {
if (keyEquals(key, entry.key)) {
Expand Down Expand Up @@ -674,15 +674,15 @@ public Enumeration<Object> keys() {
*/
public Object put(Object key, Object value) {
if (key != null && value != null) {
int index = (hashCode(key) & 0x7FFFFFFF) % elementData.length;
int index = (hashCode(key) & 0x7F_FFF_FFF) % elementData.length;
HashMapEntry entry = elementData[index];
while (entry != null && !keyEquals(key, entry.key)) {
entry = entry.next;
}
if (entry == null) {
if (++elementCount > threshold) {
rehash();
index = (hashCode(key) & 0x7FFFFFFF) % elementData.length;
index = (hashCode(key) & 0x7F_FFF_FFF) % elementData.length;
}
if (index < firstSlot) {
firstSlot = index;
Expand Down Expand Up @@ -720,7 +720,7 @@ private void rehash() {
for (int i = elementData.length; --i >= 0;) {
HashMapEntry entry = elementData[i];
while (entry != null) {
int index = (hashCode(entry.key) & 0x7FFFFFFF) % length;
int index = (hashCode(entry.key) & 0x7F_FFF_FFF) % length;
if (index < firstSlot) {
firstSlot = index;
}
Expand All @@ -746,7 +746,7 @@ private void rehash() {
*/
public Object remove(Object key) {
HashMapEntry last = null;
int index = (hashCode(key) & 0x7FFFFFFF) % elementData.length;
int index = (hashCode(key) & 0x7F_FFF_FFF) % elementData.length;
HashMapEntry entry = elementData[index];
while (entry != null && !keyEquals(key, entry.key)) {
last = entry;
Expand Down

0 comments on commit 1b2d9d8

Please sign in to comment.