(int index)
| 18 | } |
| 19 | |
| 20 | public double get(int index) { |
| 21 | if (index >= capacity) { |
| 22 | throw new IndexOutOfBoundsException(); |
| 23 | } |
| 24 | if (index >= size()) { |
| 25 | throw new IndexOutOfBoundsException(); |
| 26 | } |
| 27 | |
| 28 | return elements[(start + index) % capacity]; |
| 29 | } |
| 30 | |
| 31 | public boolean isEmpty() { |
| 32 | return start == -1 && end == -1; |