Skip to content

Commit

Permalink
Improve return value types in distributed map.
Browse files Browse the repository at this point in the history
  • Loading branch information
kuujo committed Oct 4, 2015
1 parent e63f10b commit ac6e782
Showing 1 changed file with 7 additions and 7 deletions.
Expand Up @@ -175,8 +175,7 @@ public CompletableFuture<V> putIfAbsent(K key, V value, Duration ttl) {
.withKey(key)
.withValue(value)
.withTtl(ttl.toMillis())
.build())
.thenApply(result -> result);
.build());
}

/**
Expand All @@ -190,8 +189,7 @@ public CompletableFuture<Boolean> remove(K key, V value) {
return submit(MapCommands.RemoveIfPresent.builder()
.withKey(key)
.withValue(value)
.build())
.thenApply(result -> (boolean) result);
.build());
}

/**
Expand All @@ -201,11 +199,13 @@ public CompletableFuture<Boolean> remove(K key, V value) {
* @param value The value with which to replace the key if it exists.
* @return A completable future to be completed with the result once complete.
*/
public CompletableFuture<Object> replace(K key, V value) {
@SuppressWarnings("unchecked")
public CompletableFuture<V> replace(K key, V value) {
return submit(MapCommands.Replace.builder()
.withKey(key)
.withValue(value)
.build());
.build())
.thenApply(result -> (V) result);
}

/**
Expand All @@ -217,7 +217,7 @@ public CompletableFuture<Object> replace(K key, V value) {
* @return A completable future to be completed with the result once complete.
*/
@SuppressWarnings("unchecked")
public CompletableFuture<Object> replace(K key, V value, Duration ttl) {
public CompletableFuture<V> replace(K key, V value, Duration ttl) {
return submit(MapCommands.Replace.builder()
.withKey(key)
.withValue(value)
Expand Down

0 comments on commit ac6e782

Please sign in to comment.