You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: core/src/main/java/overflowdb/AdjacentNodes.java
+54-50Lines changed: 54 additions & 50 deletions
Original file line number
Diff line number
Diff line change
@@ -35,65 +35,69 @@ public class AdjacentNodes {
35
35
* getOffset(2 * kindOffset + 1) gets the length of the relevant slice in nodesWithEdgeProperties of the desired kindOffset (get the kindOffset from layout info)
36
36
*/
37
37
publicintgetOffset(intpos){
38
-
if(offsetsinstanceofbyte[]){
39
-
return ((byte[]) offsets)[pos];
40
-
} elseif(offsetsinstanceofshort[]){
41
-
return ((short[]) offsets)[pos];
42
-
} elseif (offsetsinstanceofint[]){
43
-
return ((int[]) offsets)[pos];
44
-
} elsethrownewRuntimeException("corrupt state: offsets of type " + offsets.getClass().getName());
38
+
returnswitch (offsets) {
39
+
casebyte[] bytes -> bytes[pos];
40
+
caseshort[] shorts -> shorts[pos];
41
+
caseint[] ints -> ints[pos];
42
+
casenull, default -> {
43
+
assertoffsets != null;
44
+
thrownewRuntimeException("corrupt state: offsets of type " + offsets.getClass().getName());
45
+
}
46
+
};
45
47
}
46
48
47
49
/** Attempts to update AdjacentNodes in-place and return this; otherwise, create a new AdjacentNodes and return that.
0 commit comments