Skip to content

Commit

Permalink
Update HashMap.php
Browse files Browse the repository at this point in the history
  • Loading branch information
isszz committed Aug 14, 2023
1 parent 203b7df commit db1e6c4
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/HashMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class HashMap
*/
public function put($key, $value)
{
if (! $this->containsKey($key)) {
if (!$this->containsKey($key)) {
$this->hashTable[$key] = $value;
return null;
}
Expand Down Expand Up @@ -58,11 +58,11 @@ public function remove($key)
if ($this->containsKey($key)) {
$tempTable = [];
$tempValue = $this->hashTable[$key];
foreach ($this->hashTable as $k => $v) {
if ($k !== $key) {
$tempTable[$k] = $v;
}
}
foreach ($this->hashTable as $k => $v) {
if ($k !== $key) {
$tempTable[$k] = $v;
}
}
$this->hashTable = $tempTable;
return $tempValue;
}
Expand Down Expand Up @@ -145,7 +145,7 @@ public function containsValue($value)
*/
public function containsKey($key)
{
return array_key_exists($key, $this->hashTable);
return array_key_exists($key, $this->hashTable);
}

/**
Expand Down

0 comments on commit db1e6c4

Please sign in to comment.