(String @Nullable [] strs)
| 55 | } |
| 56 | |
| 57 | public static String @NotNull [] trim(String @Nullable [] strs) { |
| 58 | if (strs == null) |
| 59 | return EMPTY; |
| 60 | int n = 0; |
| 61 | for (int i = 0; i < strs.length; i++) |
| 62 | if (strs[i] != null && !(strs[i] = strs[i].trim()).isEmpty()) |
| 63 | n++; |
| 64 | if (n == strs.length) |
| 65 | return strs; |
| 66 | if (n == 0) |
| 67 | return EMPTY; |
| 68 | String[] newStrs = new String[n]; |
| 69 | for (int i = 0, j = 0; i < strs.length; i++) |
| 70 | if (strs[i] != null && !strs[i].isEmpty()) |
| 71 | newStrs[j++] = strs[i]; |
| 72 | return newStrs; |
| 73 | } |
| 74 | |
| 75 | public static @NotNull String stacktrace(@NotNull Throwable ex) { |
| 76 | try (var out = new ByteArrayOutputStream(); |
no test coverage detected