Replace manual checks with equivalent `Optional.ofNullable()`

This commit is contained in:
Ivan Vilata-i-Balaguer 2016-04-08 09:19:24 +02:00
parent 0068ffa416
commit c5d760b2a0

View File

@ -109,8 +109,8 @@ public class P2PService implements SetupListener, MessageListener, ConnectionLis
this.torDir = torDir;
this.clock = clock;
optionalEncryptionService = encryptionService == null ? Optional.empty() : Optional.of(encryptionService);
optionalKeyRing = keyRing == null ? Optional.empty() : Optional.of(keyRing);
optionalEncryptionService = Optional.ofNullable(encryptionService);
optionalKeyRing = Optional.ofNullable(keyRing);
init(useLocalhost, networkId, storageDir);
}