On 23/08/2025 20:36, Daniel Tavares wrote:
:

*Proposed Method*

default T getRandom() {
    if (isEmpty()) return null;
    int index = ThreadLocalRandom.current().nextInt(size());
    return get(index);
}

Add Lists that are mutable and support concurrent access to your list to think about. These implementations would need to be updated to implement this method, otherwise you risk getting IOOBE with the default method.

-Alan

Reply via email to