Index: src/java/org/apache/lucene/document/Document.java
===================================================================
--- src/java/org/apache/lucene/document/Document.java	(revision 830661)
+++ src/java/org/apache/lucene/document/Document.java	Sun Mar 21 11:34:56 CET 2010
@@ -36,7 +36,7 @@
  * IndexReader#document(int)}.
  */
 
-public final class Document implements java.io.Serializable {
+public final class Document implements java.io.Serializable, Iterable<Fieldable> {
   List<Fieldable> fields = new ArrayList<Fieldable>();
   private float boost = 1.0f;
 
@@ -169,11 +169,36 @@
    * <i>not</i> available in documents retrieved from the
    * index, e.g. {@link Searcher#doc(int)} or {@link
    * IndexReader#document(int)}.
+   *
+   * @deprecated This method allows the fields in a Document to be changed
+   *             externally and will be removed in a future version.
+   *             Document now implements {@link Iterable} to facilitate iterating
+   *             over fields.  To change the fields in a Document, use
+   *             {@link #add(Fieldable)} and {@link #removeField(String)}
    */
+  @Deprecated
   public final List<Fieldable> getFields() {
     return fields;
   }
 
+  /**
+   * Returns an unmodifiable Iterator over the Fieldables in the Document
+   *
+   * @return Iterator over the Fieldables in the Document
+   */
+  public Iterator<Fieldable> iterator() {
+    return Collections.unmodifiableList(fields).iterator();
+  }
+
+  /**
+   * Returns the number of fields in the Document
+   *
+   * @return Number of Fields in the Document
+   */
+  public int getNumFields() {
+    return fields.size();
+  }
+
   private final static Field[] NO_FIELDS = new Field[0];
   
   /**
@@ -224,8 +249,7 @@
      return result.toArray(new Fieldable[result.size()]);
    }
 
-
-   private final static String[] NO_STRINGS = new String[0];
+  private final static String[] NO_STRINGS = new String[0];
 
   /**
    * Returns an array of values of the field specified as the method parameter.
