Use isEmpty() instead of size() == 0 05/17605/3
authorRobert Varga <rovarga@cisco.com>
Thu, 2 Apr 2015 09:03:00 +0000 (11:03 +0200)
committerTom Pantelis <tpanteli@brocade.com>
Thu, 2 Apr 2015 07:14:28 +0000 (03:14 -0400)
isEmpty() is a simpler check and a bit more explicit.

Change-Id: I336acfba64da299d00ccff5abcd850058c85c9e0
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ThreePhaseCommitCohortProxy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java

index aeb4062103d1c0fc77c29f0c733447728a60194f..0b826071ecbd2ec93f5ecbfaaaffe9c81ffefbd2 100644 (file)
@@ -209,7 +209,7 @@ public class ThreePhaseCommitCohortProxy implements DOMStoreThreePhaseCommitCoho
 
     @Override
     public ListenableFuture<Void> commit() {
-        OperationCallback operationCallback = (cohortFutures.size() == 0) ? NO_OP_CALLBACK :
+        OperationCallback operationCallback = cohortFutures.isEmpty() ? NO_OP_CALLBACK :
                 new TransactionRateLimitingCallback(actorContext);
 
         return voidOperation("commit", new CommitTransaction(transactionId).toSerializable(),
index e8218995809698a29baa9ebbffeaf40c49b497d1..504612a05f707381ba0f26a0b899e05dae68d289 100644 (file)
@@ -391,7 +391,7 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
         LOG.debug("Tx {} Readying {} transactions for commit", getIdentifier(),
                     txFutureCallbackMap.size());
 
-        if(txFutureCallbackMap.size() == 0) {
+        if (txFutureCallbackMap.isEmpty()) {
             onTransactionReady(Collections.<Future<ActorSelection>>emptyList());
             TransactionRateLimitingCallback.adjustRateLimitForUnusedTransaction(actorContext);
             return NoOpDOMStoreThreePhaseCommitCohort.INSTANCE;