mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-11 06:04:27 +08:00
style: do not suppress try
(#5167)
This commit is contained in:
1
pom.xml
1
pom.xml
@ -79,7 +79,6 @@
|
|||||||
<arg>-Xlint:all</arg>
|
<arg>-Xlint:all</arg>
|
||||||
<arg>-Xlint:-auxiliaryclass</arg>
|
<arg>-Xlint:-auxiliaryclass</arg>
|
||||||
<arg>-Xlint:-rawtypes</arg>
|
<arg>-Xlint:-rawtypes</arg>
|
||||||
<arg>-Xlint:-try</arg>
|
|
||||||
<arg>-Xlint:-unchecked</arg>
|
<arg>-Xlint:-unchecked</arg>
|
||||||
<arg>-Xlint:-lossy-conversions</arg>
|
<arg>-Xlint:-lossy-conversions</arg>
|
||||||
<arg>-Werror</arg>
|
<arg>-Werror</arg>
|
||||||
|
@ -68,7 +68,6 @@ final class ProductCipher {
|
|||||||
|
|
||||||
System.out.println("Plaintext: ");
|
System.out.println("Plaintext: ");
|
||||||
System.out.println(plaintext);
|
System.out.println(plaintext);
|
||||||
sc.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,6 @@ class BellmanFord /*
|
|||||||
System.out.println();
|
System.out.println();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sc.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@ public final class ReverseStack {
|
|||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
stack.push(sc.nextInt());
|
stack.push(sc.nextInt());
|
||||||
}
|
}
|
||||||
sc.close();
|
|
||||||
reverseStack(stack);
|
reverseStack(stack);
|
||||||
System.out.println("The reversed stack is:");
|
System.out.println("The reversed stack is:");
|
||||||
while (!stack.isEmpty()) {
|
while (!stack.isEmpty()) {
|
||||||
|
@ -30,12 +30,6 @@ public final class NonRepeatingElement {
|
|||||||
arr[i] = sc.nextInt();
|
arr[i] = sc.nextInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
sc.close();
|
|
||||||
} catch (Exception e) {
|
|
||||||
System.out.println("Unable to close scanner" + e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find XOR of the 2 non repeating elements
|
// Find XOR of the 2 non repeating elements
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
res ^= arr[i];
|
res ^= arr[i];
|
||||||
@ -55,7 +49,6 @@ public final class NonRepeatingElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("The two non repeating elements are " + num1 + " and " + num2);
|
System.out.println("The two non repeating elements are " + num1 + " and " + num2);
|
||||||
sc.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -47,7 +47,6 @@ public final class InsertDeleteInArray {
|
|||||||
for (i = 0; i < size2 - 1; i++) {
|
for (i = 0; i < size2 - 1; i++) {
|
||||||
System.out.println(b[i]);
|
System.out.println(b[i]);
|
||||||
}
|
}
|
||||||
s.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,13 +8,10 @@
|
|||||||
package com.thealgorithms.sorts;
|
package com.thealgorithms.sorts;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Scanner;
|
|
||||||
|
|
||||||
public class LinkListSort {
|
public class LinkListSort {
|
||||||
|
|
||||||
public static boolean isSorted(int[] p, int option) {
|
public static boolean isSorted(int[] p, int option) {
|
||||||
try (Scanner sc = new Scanner(System.in)) {
|
|
||||||
}
|
|
||||||
int[] a = p;
|
int[] a = p;
|
||||||
// Array is taken as input from test class
|
// Array is taken as input from test class
|
||||||
int[] b = p;
|
int[] b = p;
|
||||||
|
Reference in New Issue
Block a user