mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-27 06:23:08 +08:00
style: enable LocalVariableName
in CheckStyle (#5191)
* style: enable LocalVariableName in checkstyle * Removed minor bug * Resolved Method Name Bug * Changed names according to suggestions
This commit is contained in:
@ -11,7 +11,7 @@ public final class Main {
|
||||
int key;
|
||||
|
||||
HashMap h = new HashMap(7);
|
||||
Scanner In = new Scanner(System.in);
|
||||
Scanner scan = new Scanner(System.in);
|
||||
|
||||
while (true) {
|
||||
System.out.println("Enter your Choice :");
|
||||
@ -20,18 +20,18 @@ public final class Main {
|
||||
System.out.println("3. Print Table");
|
||||
System.out.println("4. Exit");
|
||||
|
||||
choice = In.nextInt();
|
||||
choice = scan.nextInt();
|
||||
|
||||
switch (choice) {
|
||||
case 1: {
|
||||
System.out.println("Enter the Key: ");
|
||||
key = In.nextInt();
|
||||
key = scan.nextInt();
|
||||
h.insertHash(key);
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
System.out.println("Enter the Key delete: ");
|
||||
key = In.nextInt();
|
||||
key = scan.nextInt();
|
||||
h.deleteHash(key);
|
||||
break;
|
||||
}
|
||||
@ -41,7 +41,7 @@ public final class Main {
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
In.close();
|
||||
scan.close();
|
||||
return;
|
||||
}
|
||||
default: {
|
||||
|
@ -11,7 +11,7 @@ public final class MainCuckooHashing {
|
||||
int key;
|
||||
|
||||
HashMapCuckooHashing h = new HashMapCuckooHashing(7);
|
||||
Scanner In = new Scanner(System.in);
|
||||
Scanner scan = new Scanner(System.in);
|
||||
|
||||
while (true) {
|
||||
System.out.println("_________________________");
|
||||
@ -24,18 +24,18 @@ public final class MainCuckooHashing {
|
||||
System.out.println("6. Check load factor");
|
||||
System.out.println("7. Rehash Current Table");
|
||||
|
||||
choice = In.nextInt();
|
||||
choice = scan.nextInt();
|
||||
|
||||
switch (choice) {
|
||||
case 1: {
|
||||
System.out.println("Enter the Key: ");
|
||||
key = In.nextInt();
|
||||
key = scan.nextInt();
|
||||
h.insertKey2HashTable(key);
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
System.out.println("Enter the Key delete: ");
|
||||
key = In.nextInt();
|
||||
key = scan.nextInt();
|
||||
h.deleteKeyFromHashTable(key);
|
||||
break;
|
||||
}
|
||||
@ -45,12 +45,12 @@ public final class MainCuckooHashing {
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
In.close();
|
||||
scan.close();
|
||||
return;
|
||||
}
|
||||
case 5: {
|
||||
System.out.println("Enter the Key to find and print: ");
|
||||
key = In.nextInt();
|
||||
key = scan.nextInt();
|
||||
System.out.println("Key: " + key + " is at index: " + h.findKeyInTable(key) + "\n");
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user