Curriculum design patterns factory method design pattern succinctly 5-3 parse the source code

1 Source resolve

1.1 collection of analytical iterator

 

 

 

 

1 Source resolve

1.1  Iterator parsing collection of

Collection:

 

Iterator<E> iterator();

    /**
     * Returns an array containing all of the elements in this collection.
     * If this collection makes any guarantees as to what order its elements
     * are returned by its iterator, this method must return the elements in
     * the same order.
     *
     * <p>The returned array will be "safe" in that no references to it are
     * maintained by this collection.  (In other words, this method must
     * allocate a new array even if this collection is backed by an array).
     * The caller is thus free to modify the returned array.
     *
     * <p>This method acts as bridge between array-based and collection-based
     * APIs.
     *
     * @return an array containing all of the elements in this collection
     */

 

 

HashMap

 public Iterator<Map.Entry<K,V>> iterator() {
            return newEntryIterator();
        }

 

Guess you like

Origin www.cnblogs.com/1446358788-qq/p/11285027.html