(int size)
| 14 | // Has it wrapped around the circular queue? |
| 15 | private boolean wrapped = false; |
| 16 | public CircularQueue(int size) { |
| 17 | data = new Object[size]; |
| 18 | // Must be true after construction: |
| 19 | assert invariant(); |
| 20 | } |
| 21 | public boolean empty() { |
| 22 | return !wrapped && in == out; |
| 23 | } |