style: enable NeedBraces in checkstyle (#5227)

* enable style NeedBraces

* style: enable NeedBraces in checkstyle

---------

Co-authored-by: Samuel Facchinello <samuel.facchinello@piksel.com>
This commit is contained in:
Samuel Facchinello
2024-06-13 21:00:16 +02:00
committed by GitHub
parent 51fcc66345
commit 87b17e0571
68 changed files with 629 additions and 261 deletions

View File

@@ -68,10 +68,14 @@ public class HashMap {
public Node findKey(int key) {
if (!isEmpty()) {
Node temp = first;
if (temp.getKey() == key) return temp;
if (temp.getKey() == key) {
return temp;
}
while ((temp = temp.getNext()) != null) {
if (temp.getKey() == key) return temp;
if (temp.getKey() == key) {
return temp;
}
}
}
return null;

View File

@@ -188,12 +188,14 @@ public class HashMapCuckooHashing {
throw new IllegalArgumentException("Table is empty");
}
if (Objects.equals(buckets[hash], wrappedInt)) return hash;
if (Objects.equals(buckets[hash], wrappedInt)) {
return hash;
}
hash = hashFunction2(key);
if (!Objects.equals(buckets[hash], wrappedInt))
if (!Objects.equals(buckets[hash], wrappedInt)) {
throw new IllegalArgumentException("Key " + key + " not found in table");
else {
} else {
return hash;
}
}