add hashCode() and equals() to Rfc822Token, as well as a convenience tokenizer method to Rfc822Tokenizer, as part of a calendar guest bugfix.
diff --git a/core/java/android/text/util/Rfc822Token.java b/core/java/android/text/util/Rfc822Token.java
index 7fe11bc..0edeeb5 100644
--- a/core/java/android/text/util/Rfc822Token.java
+++ b/core/java/android/text/util/Rfc822Token.java
@@ -168,5 +168,31 @@
 
         return sb.toString();
     }
+
+    public int hashCode() {
+        int result = 17;
+        if (mName != null) result = 31 * result + mName.hashCode();
+        if (mAddress != null) result = 31 * result + mAddress.hashCode();
+        if (mComment != null) result = 31 * result + mComment.hashCode();
+        return result;
+    }
+
+    private static boolean stringEquals(String a, String b) {
+        if (a == null) {
+            return (b == null);
+        } else {
+            return (a.equals(b));
+        }
+    }
+
+    public boolean equals(Object o) {
+        if (!(o instanceof Rfc822Token)) {
+            return false;
+        }
+        Rfc822Token other = (Rfc822Token) o;
+        return (stringEquals(mName, other.mName) &&
+                stringEquals(mAddress, other.mAddress) &&
+                stringEquals(mComment, other.mComment));
+    }
 }
 
diff --git a/core/java/android/text/util/Rfc822Tokenizer.java b/core/java/android/text/util/Rfc822Tokenizer.java
index d4e78b0..cb39f7de 100644
--- a/core/java/android/text/util/Rfc822Tokenizer.java
+++ b/core/java/android/text/util/Rfc822Tokenizer.java
@@ -19,6 +19,7 @@
 import android.widget.MultiAutoCompleteTextView;
 
 import java.util.ArrayList;
+import java.util.Collection;
 
 /**
  * This class works as a Tokenizer for MultiAutoCompleteTextView for
@@ -27,18 +28,22 @@
  * into a series of Rfc822Tokens.
  */
 public class Rfc822Tokenizer implements MultiAutoCompleteTextView.Tokenizer {
+
     /**
      * This constructor will try to take a string like
      * "Foo Bar (something) <foo\@google.com>,
      * blah\@google.com (something)"
-     * and convert it into one or more Rfc822Tokens.
+     * and convert it into one or more Rfc822Tokens, output into the supplied
+     * collection.
+     *
      * It does *not* decode MIME encoded-words; charset conversion
      * must already have taken place if necessary.
      * It will try to be tolerant of broken syntax instead of
      * returning an error.
+     *
+     * @hide
      */
-    public static Rfc822Token[] tokenize(CharSequence text) {
-        ArrayList<Rfc822Token> out = new ArrayList<Rfc822Token>();
+    public static void tokenize(CharSequence text, Collection<Rfc822Token> out) {
         StringBuilder name = new StringBuilder();
         StringBuilder address = new StringBuilder();
         StringBuilder comment = new StringBuilder();
@@ -148,7 +153,21 @@
                                     name.toString(),
                                     comment.toString()));
         }
+    }
 
+    /**
+     * This method will try to take a string like
+     * "Foo Bar (something) &lt;foo\@google.com&gt;,
+     * blah\@google.com (something)"
+     * and convert it into one or more Rfc822Tokens.
+     * It does *not* decode MIME encoded-words; charset conversion
+     * must already have taken place if necessary.
+     * It will try to be tolerant of broken syntax instead of
+     * returning an error.
+     */
+    public static Rfc822Token[] tokenize(CharSequence text) {
+        ArrayList<Rfc822Token> out = new ArrayList<Rfc822Token>();
+        tokenize(text, out);
         return out.toArray(new Rfc822Token[out.size()]);
     }