docs: @SuppressWarnings("unchecked")
      public static <T> Collection<T> toCollection(Object iterableResult) {
          if (iterableResult.getClass().isArray()) {
              List<Object> collect = IntStream.range(0, Array.getLength(iterableResult))
                      .mapToObj(i -> Array.get(iterableResult, i))
                      .collect(Collectors.toList());
              return (List<T>) collect;
          }
          if (iterableResult instanceof Collection) {
              return (Collection<T>) iterableResult;
          }
          Iterable<T> iterable = (Iterable<T>) iterableResult;
          Iterator<T> iterator = iterable.iterator();
          List<T> list = new ArrayList<>();
          while (iterator.hasNext()) {
              list.add(iterator.next());
          }
          return list;
      }