mirror of
https://github.com/TheAlgorithms/Java.git
synced 2026-03-13 08:40:43 +08:00
* fix: revert ReverseStack deletions and ensure lint compliance * Fix formatting for ReverseStack and test files * Delete ReverseStackUsingRecursion and its test as requested --------- Co-authored-by: Deniz Altunkapan <93663085+DenizAltunkapan@users.noreply.github.com>
This commit is contained in:
@@ -38,6 +38,9 @@ public final class ReverseStack {
|
||||
* @param stack the stack to reverse; should not be null
|
||||
*/
|
||||
public static void reverseStack(Stack<Integer> stack) {
|
||||
if (stack == null) {
|
||||
throw new IllegalArgumentException("Stack cannot be null");
|
||||
}
|
||||
if (stack.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user