Class SafeExtensionsKt

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • 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.