File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 99 *
1010 */
1111class Queue {
12+ /**
13+ * Default initial capacity.
14+ */
15+ private static final int DEFAULT_CAPACITY = 10 ;
16+
1217 /**
1318 * Max size of the queue
1419 */
@@ -30,6 +35,13 @@ class Queue {
3035 */
3136 private int nItems ;
3237
38+ /**
39+ * init with DEFAULT_CAPACITY
40+ */
41+ public Queue () {
42+ this (DEFAULT_CAPACITY );
43+ }
44+
3345 /**
3446 * Constructor
3547 *
Original file line number Diff line number Diff line change @@ -34,6 +34,11 @@ public static void main(String[] args) {
3434 System .out .println (myStackArray .peek ()); // will print 2
3535 }
3636
37+ /**
38+ * Default initial capacity.
39+ */
40+ private static final int DEFAULT_CAPACITY = 10 ;
41+
3742 /**
3843 * The max size of the Stack
3944 */
@@ -49,6 +54,13 @@ public static void main(String[] args) {
4954 */
5055 private int top ;
5156
57+ /**
58+ * init Stack with DEFAULT_CAPACITY
59+ */
60+ public StackArray () {
61+ this (DEFAULT_CAPACITY );
62+ }
63+
5264 /**
5365 * Constructor
5466 *
You can’t perform that action at this time.
0 commit comments