Class SafeExtensionsKt
-
- All Implemented Interfaces:
public final class SafeExtensionsKt
-
-
Method Summary
Modifier and Type Method Description final static <K extends Any, V extends Any> Result<V>
safeGet(Cache<K, V> $self, K key)
Safely gets a value from the cache, returning a Result. final static <K extends Any, V extends Any> Result<V>
getOrNull(Cache<K, V> $self, K key)
Safely gets a value from the cache, returning a Result. final static <K extends Any, V extends Any> Result<Unit>
putOrNull(Cache<K, V> $self, K key, V value)
Safely puts a value, returning a Result. final static <K extends Any, V extends Any> Result<V>
removeOrNull(Cache<K, V> $self, K key)
Safely removes a value, returning a Result. final static <K extends Any, V extends Any> Unit
ifContains(Cache<K, V> $self, K key, Function1<V, Unit> action)
Executes the given action if the cache contains the key. final static <K extends Any, V extends Any> Unit
ifNotContains(Cache<K, V> $self, K key, Function0<Unit> action)
Executes the given action if the cache does not contain the key. -
-
Method Detail
-
safeGet
final static <K extends Any, V extends Any> Result<V> safeGet(Cache<K, V> $self, K key)
Safely gets a value from the cache, returning a Result.
-
getOrNull
final static <K extends Any, V extends Any> Result<V> getOrNull(Cache<K, V> $self, K key)
Safely gets a value from the cache, returning a Result. Alias for safeGet for compatibility.
-
putOrNull
final static <K extends Any, V extends Any> Result<Unit> putOrNull(Cache<K, V> $self, K key, V value)
Safely puts a value, returning a Result.
-
removeOrNull
final static <K extends Any, V extends Any> Result<V> removeOrNull(Cache<K, V> $self, K key)
Safely removes a value, returning a Result.
-
ifContains
final static <K extends Any, V extends Any> Unit ifContains(Cache<K, V> $self, K key, Function1<V, Unit> action)
Executes the given action if the cache contains the key.
-
ifNotContains
final static <K extends Any, V extends Any> Unit ifNotContains(Cache<K, V> $self, K key, Function0<Unit> action)
Executes the given action if the cache does not contain the key.
-
-
-
-