Replace LinkedList with ArrayDeque for constant time size() operation