Implement rate limiting by cookie ID
Accessing elements of a linked list with .get(i) is expensive, because it's an \$O(N)\$ operation compared to \$O(1)\$ of array backed structures. You should avoid doing this, and use an enhanced for-each loop instead, for example:

for (Long currentTimeStamp : timestamps) {
    if (currentTimeStamp  &gt;= oldestTime) {
        newTimestamps.add(currentTimeStamp);
    } else {
        break;
    }
}


If you need the element index, you can add a counting variable "manually" (declared before the loop, and increments in the loop body).