Fix StackArray.java resize()

This commit is contained in:
yeongmo-j 2019-09-03 12:23:01 +09:00
parent c5e32eaa15
commit df6e16438c

View File

@ -109,14 +109,13 @@ public class StackArray {
}
private void resize(int newSize) {
// private int[] transferArray = new int[newSize]; we can't put modifiers here !
int[] transferArray = new int[newSize];
// for(int i = 0; i < stackArray.length(); i++){ the length isn't a method .
for (int i = 0; i < stackArray.length; i++) {
transferArray[i] = stackArray[i];
stackArray = transferArray;
}
// This reference change might be nice in here
stackArray = transferArray;
maxSize = newSize;
}