Skip to content

Commit beda3d6

Browse files
committed
style: improve readability of array values in getSanitizedValues
1 parent 4ecee97 commit beda3d6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

components/abstractions/src/main/java/com/microsoft/kiota/RequestInformation.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -462,18 +462,20 @@ private static Object getSanitizedValues(Object value) {
462462
return null;
463463
}
464464
if (value.getClass().isArray()) {
465-
if (((Object[]) value).length > 0) {
466-
if (((Object[]) value)[0].getClass().isArray()) {
465+
final Object[] values = (Object[]) value;
466+
467+
if (values.length > 0) {
468+
if (values[0].getClass().isArray()) {
467469
throw new IllegalArgumentException("multidimensional arrays are not supported");
468470
}
469471

470472
final ArrayList<String> result = new ArrayList<>();
471-
for (final Object item : (Object[]) value) {
473+
for (final Object item : values) {
472474
result.add(getSanitizedValues(item).toString());
473475
}
474476
return result;
475477
}
476-
return Arrays.asList((Object[]) value);
478+
return Arrays.asList(values);
477479
} else if (value instanceof ValuedEnum) {
478480
return ((ValuedEnum) value).getValue();
479481
} else if (value instanceof UUID) {

0 commit comments

Comments
 (0)