AccountCache: Remove unused getIfPresent

Change-Id: Id5689dc5a42de257915e960a46cfaca080dff06f
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2017-06-06 17:20:42 +02:00
parent b34596f01d
commit 7c1ec889cf
3 changed files with 1 additions and 22 deletions

View File

@@ -42,16 +42,6 @@ public interface AccountCache {
@Nullable
AccountState getOrNull(Account.Id accountId);
/**
* Returns an {@code AccountState} instance for the given account ID if it is present in the
* cache.
*
* @param accountId ID of the account that should be retrieved
* @return {@code AccountState} instance for the given account ID if it is present in the cache,
* otherwise {@code null}
*/
AccountState getIfPresent(Account.Id accountId);
AccountState getByUsername(String username);
void evict(Account.Id accountId) throws IOException;

View File

@@ -110,12 +110,6 @@ public class AccountCacheImpl implements AccountCache {
}
}
@Override
public AccountState getIfPresent(Account.Id accountId) {
Optional<AccountState> state = byId.getIfPresent(accountId);
return state != null ? state.orElse(missing(accountId)) : null;
}
@Override
public AccountState getByUsername(String username) {
try {

View File

@@ -35,7 +35,7 @@ public class FakeAccountCache implements AccountCache {
@Override
public synchronized AccountState get(Account.Id accountId) {
AccountState state = getIfPresent(accountId);
AccountState state = byId.get(accountId);
if (state != null) {
return state;
}
@@ -48,11 +48,6 @@ public class FakeAccountCache implements AccountCache {
return byId.get(accountId);
}
@Override
public synchronized AccountState getIfPresent(Account.Id accountId) {
return byId.get(accountId);
}
@Override
public synchronized AccountState getByUsername(String username) {
return byUsername.get(username);