code: private static Iterator<?> computeIteratedObjectIterator(final Object iteratedObject) {
          if (iteratedObject == null) {
              return Collections.EMPTY_LIST.iterator();
          }
          if (iteratedObject instanceof Collection<?>) {
              return ((Collection<?>)iteratedObject).iterator();
          }
          if (iteratedObject instanceof Map<?,?>) {
              return ((Map<?,?>)iteratedObject).entrySet().iterator();
          }
          if (iteratedObject.getClass().isArray()) {
              return new Iterator<Object>() {
  
                  protected final Object array = iteratedObject;
                  protected final int length = Array.getLength(this.array);
                  private int i = 0;
  
                  public boolean hasNext() {
                      return this.i < this.length;
                  }
  
                  public Object next() {
                      return Array.get(this.array, i++);
                  }
  
                  public void remove() {
                      throw new UnsupportedOperationException("Cannot remove from an array iterator");
                  }
  
              };
          }
          if (iteratedObject instanceof Iterable<?>) {
              return ((Iterable<?>)iteratedObject).iterator();
          }
          if (iteratedObject instanceof Iterator<?>) {
              return (Iterator<?>)iteratedObject;
          }
          if (iteratedObject instanceof Enumeration<?>) {
              return new Iterator<Object>() {
  
                  protected final Enumeration<?> enumeration = (Enumeration<?>)iteratedObject;
  
  
                  public boolean hasNext() {
                      return this.enumeration.hasMoreElements();
                  }
  
                  public Object next() {
                      return this.enumeration.nextElement();
                  }
  
                  public void remove() {
                      throw new UnsupportedOperationException("Cannot remove from an Enumeration iterator");
                  }
  
              };
          }
          return Collections.singletonList(iteratedObject).iterator();
      }
docs: /*
  Creates, from the iterated object (e.g. right part of a th:each expression), the iterator that will be used.