Create a new {@link Iterator} for the supplied object.

@param object the object to build an iterator from
@return an {@link Iterator} for the <code>object</code> or <code>null</code> if the value is null.
439439
public static final Iterator createIterator(Object object) {
        LOGGER.debug("Create an iterator for class: " + (object == null ? "null" : object.getClass().getName()));

        if(object == null)
            return null;

        if(object instanceof Iterator) {
            return (Iterator)object;
        } else if(object instanceof Collection) {
            Collection collection = (Collection)object;
            return collection.iterator();
        } else if(object instanceof Map) {
            return new MapIterator((Map)object);
        } else if(object.getClass().isArray()) {
            return new ArrayIterator(object);
        } else if(object instanceof Enumeration)
            return new EnumerationIterator((Enumeration)object);
        else if(object instanceof ResultSet && !(object instanceof RowSet))
            return new ResultSetIterator((ResultSet)object);

        // check to see if there is a registered IteratorPlant that can handle this type
        Iterator ret = null;
        Iterator factories = ITERATOR_FACTORIES.keySet().iterator();
        while(factories.hasNext()) {
            IteratorPlant plant = (IteratorPlant)ITERATOR_FACTORIES.get(factories.next());
            ret = plant.createIterator(object);

            if(ret != null) return ret;
        }

        return new AtomicObjectIterator(object);
    }
991239
@Help(help = "Create the object of type {#}")
  public T create(final T object) throws SDKException {
    return (T) requestPost(object);
  }
670817
public HashCodeBuilder append(final Object object) {
        if (object == null) {
            iTotal = iTotal * iConstant;

        } else {
            if (object.getClass().isArray()) {
                // factor out array case in order to keep method small enough
                // to be inlined
                appendArray(object);
            } else {
                iTotal = iTotal * iConstant + object.hashCode();
            }
        }
        return this;
    }
1348918
public Iterator<Object> valueIterator() {
        final Iterator<String> iter = keyIterator();
        return new Iterator<Object>() {
            public boolean hasNext() {
                return iter.hasNext();
            }

            public Object next() {
                String key = iter.next();
                return get(key);
            }

            public void remove() {
                throw new UnsupportedOperationException("remove() not supported for BeanMap");
            }
        };
    }
271069
@SuppressWarnings("unchecked")
	protected static final Tree toTree(Object object) {
		if (object == null) {
			return new Tree((Tree) null, null, null);
		}
		if (object instanceof Tree) {
			return (Tree) object;
		}
		if (object instanceof Map) {
			return new Tree((Map<String, Object>) object);
		}
		return new Tree((Tree) null, null, object);
	}
977031
public static Iterator makeIterator( Object obj, IType typeHint )
  {
    if( obj == null )
    {
      return null;
    }

    if( typeHint.isArray() &&
        (obj.getClass().isArray() || TypeSystem.getFromObject( obj ).isArray()) )
    {
      return new ArrayIterator( obj, typeHint );
    }

    if( obj instanceof Iterable )
    {
      return ((Iterable)obj).iterator();
    }

    if( obj instanceof Iterator )
    {
      return(Iterator)obj;
    }

    // Treat a string as a list of characters
    if( obj instanceof String )
    {
      return new StringIterator( (String)obj );
    }

    if( obj instanceof Number )
    {
      return new NumberIterator( (Number)obj );
    }

    // Oh well. Convert to a List of length one and iterate that single element.
    return Collections.nCopies( 1, obj ).iterator();
  }
1332830
@Override
    public Iterator<Object> iterator() {
        return new Iterator<Object>() {
            Iterator<Object> iter = list.listIterator();

            @Override
            public boolean hasNext() {
                return iter.hasNext();
            }

            @Override
            public Object next() {
                return iter.next();
            }

            @Override
            public void remove() {
                iter.remove();
            }
        };
    }
1068648
public T object(Object object) throws IOException {
		text(stringifierFactory.toString(object));
		return (T) this;
	}
14226
private String buildObjectKey(final Object object) {

        String objectKey = null;
        final Class<?> objectClass = object.getClass();

        final KeyGenerator typeGenerator = objectClass.getAnnotation(KeyGenerator.class);
        if (typeGenerator == null) {
            objectKey = generateAggregatedKey(object);
        } else {
            objectKey = generateTypeKey(object, typeGenerator);
        }

        // If no Type keyGenerator neither Method Generator were used, use the default toString method
        if (objectKey == null) {
            objectKey = object.toString();
        }

        return objectKey;
    }
1218033
@Override
    protected Iterator<?> getJavaIterator(Context cx, Scriptable scope, Object obj) {
        if (obj instanceof Wrapper) {
            Object unwrapped = ((Wrapper) obj).unwrap();
            Iterator<?> iterator = null;
            if (unwrapped instanceof Iterator)
                iterator = (Iterator<?>) unwrapped;
            if (unwrapped instanceof Iterable)
                iterator = ((Iterable<?>)unwrapped).iterator();
            return iterator;
        }
        return null;
    }
8640
public Iterator<Runnable> buildIterator() {
		return new Iterator<Runnable>() {
			@Override
			public boolean hasNext() {
				return false;
			}

			@Override
			public Runnable next() {
				return null;
			}

			@Override
			public void remove() {
			}
		};
	}
344334
public Iterable<Obj> asObjSeq(final @Nullable Obj obj) {
		return new Iterable<Obj>() {
			@Override public Iterator<Obj> iterator() {
				if (obj != null) {
					final Iterator<Entry<String, Object>> i = obj.iterator();
					return new Iterator<Obj>() {
						@Override public boolean hasNext() {
							return i.hasNext();
						}
						@Override public Obj next() {
							return (Obj) i.next().getValue();
						}
						@Override public void remove() {
							Check.unsupportedoperation.fail();
						}
					};
				}
				return java.util.Collections.emptyIterator();
			}
		};
	}
165237
public static Map<String, Object> toMap(Object object) {
        if (object == null) {
            return null;
        }
        return toMap(toJSONString(object));
    }
202560
public Iterator<T> iterator() {
        return new Iterator<T>() {
            private int currentPosition = start;
            private boolean hasNext = true;

            public boolean hasNext() {
                return hasNext;
            }

            @SuppressWarnings("unchecked")
            public T next() {
                if (end == -1)
                    hasNext = !sequence.getItem(currentPosition).getClass().equals(SequenceTerminal.class);
                else
                    hasNext = currentPosition < getEnd() - 1;
                return (T) sequence.getItem(currentPosition++);
            }

            public void remove() {
                throw new UnsupportedOperationException(
                    "The remove method is not supported.");
            }
        };
    }
639770
public Iterator iterator() {
        return new Iterator() {
            private ObjectSinkNode currentNode = null;
            private ObjectSinkNode nextNode    = getFirst();

            public boolean hasNext() {
                return (this.nextNode != null);
            }

            public Object next() {
                this.currentNode = this.nextNode;
                if ( this.currentNode != null ) {
                    this.nextNode = this.currentNode.getNextObjectSinkNode();
                } else {
                    throw new NoSuchElementException( "No more elements to return" );
                }
                return this.currentNode;
            }

            public void remove() {
                if ( this.currentNode != null ) {
                    ObjectSinkNodeList.this.remove( this.currentNode );
                    this.currentNode = null;
                } else {
                    throw new IllegalStateException( "No item to remove. Call next() before calling remove()." );
                }
            }
        };
    }
36753
public static <T> T copy(final T object) {
		if (object == null) return null;
		TypeEnum type = TypeEnum.dataTypeOf(object.getClass());
		return copy(object, type);
	}
843726
public static <T> Iterator<T> toUnique(Iterator<T> self) {
        return toUnique(self, (Comparator<T>) null);
    }