CJCoding With Joseph
15free / daySign inCreate account

Complete the MiniQueue<T> class. It has two private fields first and second that act as a two-slot queue.

- add(T item) — if first is null, store the item there. Otherwise store it in second. - remove() — return the value of first, then shift second into first, and set second to null.

IMPORTANT: Do NOT write a main method. A hidden test will add two String values and two Integer values to separate queues, then call remove() twice on each and print the removed values in order.

Expected output

A
B
1
2

= newline. The output ends with a newline, so print one after the last line.

Hints4 available
Topics
GenericsClasses
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (sysout, psvm, fori)

Your output

Run your code to see the output here...

Test cases

Run your code to see test case results.