mirror of
https://github.com/TheAlgorithms/Java.git
synced 2026-03-13 08:40:43 +08:00
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:
committed by
GitHub
parent
51fcc66345
commit
87b17e0571
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user