docs: public static Set<Object> toCollection(final Object obj) {
          val c = new LinkedHashSet<Object>();
          if (obj == null) {
              LOGGER.trace("Converting null obj to empty collection");
          } else if (obj instanceof Collection) {
              c.addAll((Collection<Object>) obj);
              LOGGER.trace("Converting multi-valued element [{}]", obj);
          } else if (obj instanceof Map) {
              val map = (Map) obj;
              val set = (Set<Map.Entry>) map.entrySet();
              c.addAll(set.stream().map(e -> Pair.of(e.getKey(), e.getValue())).collect(Collectors.toSet()));
          } else if (obj.getClass().isArray()) {
              if (byte[].class.isInstance(obj)) {
                  c.add(obj);
              } else {
                  c.addAll(Arrays.stream((Object[]) obj).collect(Collectors.toSet()));
              }
              LOGGER.trace("Converting array element [{}]", obj);
          } else if (obj instanceof Iterator) {
              val it = (Iterator) obj;
              while (it.hasNext()) {
                  c.add(it.next());
              }
          } else if (obj instanceof Enumeration) {
              val it = (Enumeration) obj;
              while (it.hasMoreElements()) {
                  c.add(it.nextElement());
              }
          } else {
              c.add(obj);
              LOGGER.trace("Converting element [{}]", obj);
          }
          return c;
      }