Fix StackArray.java resize()
This commit is contained in:
parent
c5e32eaa15
commit
df6e16438c
@ -109,14 +109,13 @@ public class StackArray {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void resize(int newSize) {
|
private void resize(int newSize) {
|
||||||
// private int[] transferArray = new int[newSize]; we can't put modifiers here !
|
|
||||||
int[] transferArray = new int[newSize];
|
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++) {
|
for (int i = 0; i < stackArray.length; i++) {
|
||||||
transferArray[i] = stackArray[i];
|
transferArray[i] = stackArray[i];
|
||||||
stackArray = transferArray;
|
|
||||||
}
|
}
|
||||||
|
// This reference change might be nice in here
|
||||||
|
stackArray = transferArray;
|
||||||
maxSize = newSize;
|
maxSize = newSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user