Skip to content

Commit d8afa6e

Browse files
committed
Refactored ReverseStringUsingStack utility for reversing strings using stack
1 parent a540bc4 commit d8afa6e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/main/java/com/thealgorithms/stacks/ReverseStringUsingStack.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ private ReverseStringUsingStack() {
1111
* @return reversed string
1212
*/
1313
public static String reverse(String str) {
14-
if(str==null) {
14+
if (str == null) {
1515
throw new IllegalArgumentException("Input string cannot be null");
1616
}
1717
Stack<Character> stack = new Stack<>();

src/main/java/com/thealgorithms/strings/ReverseString.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public static String reverse3(String string) {
6666
* and then pops them off to create the reversed string.
6767
*/
6868
public static String reverse4(String str) {
69-
if(str==null) {
69+
if (str == null) {
7070
throw new IllegalArgumentException("Input string cannot be null");
7171
}
7272
Stack<Character> stack = new Stack<>();

0 commit comments

Comments
 (0)