+ 1

Im totally lost on what to do for this (enqueue) contructoin method and need some examples to push me in the right direction.

public void enqueue(E target) { /** TODO if queue is full, expand capacity the array-based data collection, * for example, doubling its size and copying the original data items into the new expanded array. * Then insert a new data item with reference to the input target into the queue * Do not forget to change the size **/ }

4th Mar 2020, 6:41 PM
Cyrus
3 ответов
+ 8
I guess the tags are misleading. Correct me if I am wrong but you are looking for a "Java code example on doubling array size for a queue if it's full." I say Java because void return type syntax is not supported in JavaScript and NetBeans is a popular IDE for Java development for Desktop applications. If yes then using tags like 'java' , 'queue' & 'array' can help Java programmers see your problem easily.
7th Mar 2020, 12:31 AM
Morpheus
Morpheus - avatar
+ 2
I wish I could help, did you find a solution?
6th Mar 2020, 10:59 PM
Jdubyou
Jdubyou - avatar
+ 2
If I understand your question correctly, I think this link might help. https://www.tutorialspoint.com/how-to-resize-an-array-in-java
7th Mar 2020, 12:47 AM
Paul K Sadler
Paul K Sadler - avatar