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 - E: The element to add to the set.

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

Return
Boolean: 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 - E: The element to add to the set.

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

expiryListener - Consumer<E>?: A listener that will be invoked when the entry expires.

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