Replace LinkedList with ArrayDeque