Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Create a new internal array with a given capacity */
- @SuppressWarnings("unchecked")
- public void resize(int capacity) {
- Item[] copy = (Item[]) new Object[capacity]; // 1
- for (int i = 0; i < length; i++) { // 2
- copy[i] = q[(i + head) % q.length]; // 2
- } // 2
- head = 0; // 3
- tail = length; // 3
- q = copy; // 4
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement