Skip to content

Commit

Permalink
Use getInt to access IntArrayList
Browse files Browse the repository at this point in the history
  • Loading branch information
raunaqmorarka authored and sopel39 committed Jul 30, 2020
1 parent 15ffd9c commit deb9c13
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public boolean contains(Block block, int position)
return containsNullElement;
}
else {
return blockPositionByHash.get(getHashPositionOfElement(block, position)) != EMPTY_SLOT;
return blockPositionByHash.getInt(getHashPositionOfElement(block, position)) != EMPTY_SLOT;
}
}

Expand All @@ -137,7 +137,7 @@ public void add(Block block, int position)
}

int hashPosition = getHashPositionOfElement(block, position);
if (blockPositionByHash.get(hashPosition) == EMPTY_SLOT) {
if (blockPositionByHash.getInt(hashPosition) == EMPTY_SLOT) {
addNewElement(hashPosition, block, position);
}
}
Expand All @@ -149,7 +149,7 @@ public int size()

public int positionOf(Block block, int position)
{
return blockPositionByHash.get(getHashPositionOfElement(block, position));
return blockPositionByHash.getInt(getHashPositionOfElement(block, position));
}

/**
Expand All @@ -159,7 +159,7 @@ private int getHashPositionOfElement(Block block, int position)
{
int hashPosition = getMaskedHash(hashPosition(elementType, block, position));
while (true) {
int blockPosition = blockPositionByHash.get(hashPosition);
int blockPosition = blockPositionByHash.getInt(hashPosition);
if (blockPosition == EMPTY_SLOT) {
// Doesn't have this element
return hashPosition;
Expand Down

0 comments on commit deb9c13

Please sign in to comment.