DomGarguilo commented on code in PR #5876:
URL: https://github.com/apache/accumulo/pull/5876#discussion_r2342326966


##########
core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/Utils.java:
##########
@@ -185,41 +185,25 @@ public static long readVLong(DataInput in) throws 
IOException {
       return firstByte;
     }
 
-    switch ((firstByte + 128) / 8) {
-      case 11:
-      case 10:
-      case 9:
-      case 8:
-      case 7:
-        return ((firstByte + 52L) << 8) | in.readUnsignedByte();
-      case 6:
-      case 5:
-      case 4:
-      case 3:
-        return ((firstByte + 88L) << 16) | in.readUnsignedShort();
-      case 2:
-      case 1:
-        return ((firstByte + 112L) << 24) | (in.readUnsignedShort() << 8) | 
in.readUnsignedByte();
-      case 0:
+    return switch ((firstByte + 128) / 8) {
+      case 11, 10, 9, 8, 7 -> ((firstByte + 52L) << 8) | in.readUnsignedByte();
+      case 6, 5, 4, 3 -> ((firstByte + 88L) << 16) | in.readUnsignedShort();
+      case 2, 1 ->
+        ((firstByte + 112L) << 24) | (in.readUnsignedShort() << 8) | 
in.readUnsignedByte();
+      case 0 -> {
         int len = firstByte + 129;
-        switch (len) {
-          case 4:
-            return in.readInt();
-          case 5:
-            return ((long) in.readInt()) << 8 | in.readUnsignedByte();
-          case 6:
-            return ((long) in.readInt()) << 16 | in.readUnsignedShort();
-          case 7:
-            return ((long) in.readInt()) << 24 | (in.readUnsignedShort() << 8)
-                | in.readUnsignedByte();
-          case 8:
-            return in.readLong();
-          default:
-            throw new IOException("Corrupted VLong encoding");
-        }
-      default:
-        throw new IllegalStateException("Internal error");
-    }
+        yield switch (len) {

Review Comment:
   Yea I think so too. Will take a while to get used to.



-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to