style: enable AvoidNestedBlocks in checkstyle (#5228)

* enable style AvoidNestedBlocks

* refactor after enable style AvoidNestedBlocks

* fix clang

* fix checkstyle

* fix pmd

---------

Co-authored-by: Samuel Facchinello <samuel.facchinello@piksel.com>
Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
This commit is contained in:
Samuel Facchinello
2024-06-14 16:57:30 +02:00
committed by GitHub
parent 87b17e0571
commit cdb3affdd9
7 changed files with 117 additions and 117 deletions

View File

@ -23,31 +23,30 @@ public final class Main {
choice = scan.nextInt();
switch (choice) {
case 1: {
case 1:
System.out.println("Enter the Key: ");
key = scan.nextInt();
h.insertHash(key);
break;
}
case 2: {
case 2:
System.out.println("Enter the Key delete: ");
key = scan.nextInt();
h.deleteHash(key);
break;
}
case 3: {
case 3:
System.out.println("Print table");
h.displayHashtable();
break;
}
case 4: {
case 4:
scan.close();
return;
}
default: {
default:
throw new IllegalArgumentException("Unexpected value: " + choice);
}
}
}
}
}

View File

@ -27,45 +27,44 @@ public final class MainCuckooHashing {
choice = scan.nextInt();
switch (choice) {
case 1: {
case 1:
System.out.println("Enter the Key: ");
key = scan.nextInt();
h.insertKey2HashTable(key);
break;
}
case 2: {
case 2:
System.out.println("Enter the Key delete: ");
key = scan.nextInt();
h.deleteKeyFromHashTable(key);
break;
}
case 3: {
case 3:
System.out.println("Print table:\n");
h.displayHashtable();
break;
}
case 4: {
case 4:
scan.close();
return;
}
case 5: {
case 5:
System.out.println("Enter the Key to find and print: ");
key = scan.nextInt();
System.out.println("Key: " + key + " is at index: " + h.findKeyInTable(key) + "\n");
break;
}
case 6: {
case 6:
System.out.printf("Load factor is: %.2f%n", h.checkLoadFactor());
break;
}
case 7: {
case 7:
h.reHashTableIncreasesTableSize();
break;
}
default: {
default:
throw new IllegalArgumentException("Unexpected value: " + choice);
}
}
}
}
}