From 9b06e5aa9e88908f095e56ccc84cb75b214ccdc7 Mon Sep 17 00:00:00 2001 From: gya12 Date: Wed, 13 Jan 2021 20:56:31 -0500 Subject: [PATCH] Update MultiStack.java Hi Gayle, is there any reason why calling stack.isFull() will not suffice? Thank you! --- .../Ch 03. Stacks and Queues/Q3_01_Three_in_One/MultiStack.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Java/Ch 03. Stacks and Queues/Q3_01_Three_in_One/MultiStack.java b/Java/Ch 03. Stacks and Queues/Q3_01_Three_in_One/MultiStack.java index 1bcb43501..017820c89 100644 --- a/Java/Ch 03. Stacks and Queues/Q3_01_Three_in_One/MultiStack.java +++ b/Java/Ch 03. Stacks and Queues/Q3_01_Three_in_One/MultiStack.java @@ -105,7 +105,7 @@ private void shift(int stackNum) { /* If this stack is at its full capacity, then you need * to move the next stack over by one element. This stack * can now claim the freed index. */ - if (stack.size >= stack.capacity) { + if (stack.isFull()) { int nextStack = (stackNum + 1) % info.length; shift(nextStack); stack.capacity++; // claim index that next stack lost