Class UtilityExtensionsKt
-
- All Implemented Interfaces:
public final class UtilityExtensionsKt
-
-
Method Summary
Modifier and Type Method Description final static <K extends Any, V extends Any> Cache<K, V>
batch(Cache<K, V> $self, Function1<Cache<K, V>, Unit> operations)
Executes a batch of operations on the cache, returning the cache itself. final static <K extends Any, V extends Any> V
computeIfAbsent(Cache<K, V> $self, K key, Function1<K, V> compute)
Computes a value for the given key if it's not present in the cache. final static <K extends Any, V extends Any> V
computeIfPresent(Cache<K, V> $self, K key, Function2<K, V, V> compute)
Computes a new value for the given key if it's present in the cache. final static <K extends Any, V extends Any> V
compute(Cache<K, V> $self, K key, Function2<K, V, V> compute)
Computes a value for the given key regardless of whether it's present. final static <K extends Any, V extends Any> V
merge(Cache<K, V> $self, K key, V value, Function2<V, V, V> merge)
Merges the given value with the existing value for the key. final static <K extends Any, V extends Any> V
replace(Cache<K, V> $self, K key, V value)
Replaces the value for the given key if it exists. final static <K extends Any, V extends Any> Boolean
replace(Cache<K, V> $self, K key, V oldValue, V newValue)
Replaces the value for the given key if it equals the expected value. final static <K extends Any, V extends Any> Unit
replaceAll(Cache<K, V> $self, Function2<K, V, V> transform)
Replaces all values using the given transformation function. final static <K extends Any, V extends Any, R extends Any> Pair<R, Long>
measureTime(Cache<K, V> $self, Function1<Cache<K, V>, R> block)
Executes the given block and measures the time taken. final static <K extends Any, V extends Any> String
summary(Cache<K, V> $self)
Returns a summary of the cache contents. -
-
Method Detail
-
batch
final static <K extends Any, V extends Any> Cache<K, V> batch(Cache<K, V> $self, Function1<Cache<K, V>, Unit> operations)
Executes a batch of operations on the cache, returning the cache itself.
-
computeIfAbsent
final static <K extends Any, V extends Any> V computeIfAbsent(Cache<K, V> $self, K key, Function1<K, V> compute)
Computes a value for the given key if it's not present in the cache.
-
computeIfPresent
final static <K extends Any, V extends Any> V computeIfPresent(Cache<K, V> $self, K key, Function2<K, V, V> compute)
Computes a new value for the given key if it's present in the cache.
-
compute
final static <K extends Any, V extends Any> V compute(Cache<K, V> $self, K key, Function2<K, V, V> compute)
Computes a value for the given key regardless of whether it's present.
-
merge
final static <K extends Any, V extends Any> V merge(Cache<K, V> $self, K key, V value, Function2<V, V, V> merge)
Merges the given value with the existing value for the key.
-
replace
final static <K extends Any, V extends Any> V replace(Cache<K, V> $self, K key, V value)
Replaces the value for the given key if it exists.
-
replace
final static <K extends Any, V extends Any> Boolean replace(Cache<K, V> $self, K key, V oldValue, V newValue)
Replaces the value for the given key if it equals the expected value.
-
replaceAll
final static <K extends Any, V extends Any> Unit replaceAll(Cache<K, V> $self, Function2<K, V, V> transform)
Replaces all values using the given transformation function.
-
measureTime
final static <K extends Any, V extends Any, R extends Any> Pair<R, Long> measureTime(Cache<K, V> $self, Function1<Cache<K, V>, R> block)
Executes the given block and measures the time taken.
-
-
-
-