ctubbsii commented on a change in pull request #1107:
URL: https://github.com/apache/fluo/pull/1107#discussion_r506711049



##########
File path: 
modules/integration-tests/src/main/java/org/apache/fluo/integration/TestUtil.java
##########
@@ -27,17 +27,13 @@ private TestUtil() {}
   private static final Bytes ZERO = Bytes.of("0");
 
   public static void increment(TransactionBase tx, Bytes row, Column col, int 
val) {
-    int prev = 0;
     String prevStr = tx.get(row, col, ZERO).toString();
-    prev = Integer.parseInt(prevStr);
-    tx.set(row, col, Bytes.of(prev + val + ""));
+    tx.set(row, col, Bytes.of(Integer.toString(Integer.parseInt(prevStr) + 
val)));
   }
 
   public static void increment(TransactionBase tx, String row, Column col, int 
val) {
-    int prev = 0;
     String prevStr = tx.gets(row, col, "0");
-    prev = Integer.parseInt(prevStr);
-    tx.set(row, col, prev + val + "");
+    tx.set(row, col, String.valueOf(Integer.parseInt(prevStr) + val));

Review comment:
       I double checked in `jshell` that `int + int + ""` does do the sum 
first, then convert to a String.
   
   Also, it looks like `String.valueOf(int)` just calls 
`Integer.toString(int)`, so we can just use that for both.
   
   ```suggestion
       tx.set(row, col, Integer.toString(Integer.parseInt(prevStr) + val));
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to