tuweni / org.apache.tuweni.concurrent / ExpiringSet / add

add

fun add(element: E): Boolean (source) fun add(element: E, expiry: Long): Boolean (source)

Adds the specified element to this set if it is not already present, and expires the entry when the specified expiry time is reached.

Parameters

element - The element to add to the set.

expiry - The expiry time for the element, in milliseconds since the epoch.

Return
true if this set did not already contain the specified element.

fun add(element: E, expiry: Long, @Nullable expiryListener: Consumer<E>?): Boolean (source)

Adds the specified element to this set if it is not already present, and expires the entry when the specified expiry time is reached.

Parameters

element - The element to add to the set.

expiry - The expiry time for the element, in milliseconds since the epoch.

expiryListener - A listener that will be invoked when the entry expires.

Return
true if this set did not already contain the specified element.