Merge pull request #819 from yeongmo-j/master

Fix StackArray.java resize()
This commit is contained in:
Yang Libin
2019-09-03 11:29:23 +08:00
committed by GitHub

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;
}