init with DEFAULT_CAPACITY

This commit is contained in:
shellhub
2019-09-28 22:29:47 +08:00
parent cfc26a865e
commit 20cd57cf81
2 changed files with 24 additions and 0 deletions

View File

@ -9,6 +9,11 @@ package DataStructures.Queues;
*
*/
class Queue {
/**
* Default initial capacity.
*/
private static final int DEFAULT_CAPACITY = 10;
/**
* Max size of the queue
*/
@ -30,6 +35,13 @@ class Queue {
*/
private int nItems;
/**
* init with DEFAULT_CAPACITY
*/
public Queue() {
this(DEFAULT_CAPACITY);
}
/**
* Constructor
*