diff options
author | Joe Onorato <joeo@android.com> | 2009-05-12 14:42:58 -0400 |
---|---|---|
committer | Joe Onorato <joeo@android.com> | 2009-05-12 23:40:45 -0400 |
commit | d39afbdc92e95e597c311e78ac32edaad27fcf0d (patch) | |
tree | 72b8b6bee6df8f80d72cd782873c78dbc7f38b5c | |
parent | c5b0e6e4eb09a4dd8fc1cfcfca959262705d84d0 (diff) | |
download | frameworks_base-d39afbdc92e95e597c311e78ac32edaad27fcf0d.zip frameworks_base-d39afbdc92e95e597c311e78ac32edaad27fcf0d.tar.gz frameworks_base-d39afbdc92e95e597c311e78ac32edaad27fcf0d.tar.bz2 |
Make android.content.ComponentName implement java.lang.Comparable.
-rw-r--r-- | api/current.xml | 15 | ||||
-rw-r--r-- | core/java/android/content/ComponentName.java | 12 |
2 files changed, 26 insertions, 1 deletions
diff --git a/api/current.xml b/api/current.xml index 7209b2f..623b986 100644 --- a/api/current.xml +++ b/api/current.xml @@ -22658,6 +22658,8 @@ deprecated="not deprecated" visibility="public" > +<implements name="java.lang.Comparable"> +</implements> <implements name="android.os.Parcelable"> </implements> <constructor name="ComponentName" @@ -22706,6 +22708,19 @@ <parameter name="in" type="android.os.Parcel"> </parameter> </constructor> +<method name="compareTo" + return="int" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="that" type="android.content.ComponentName"> +</parameter> +</method> <method name="describeContents" return="int" abstract="false" diff --git a/core/java/android/content/ComponentName.java b/core/java/android/content/ComponentName.java index 32c6864..0455202 100644 --- a/core/java/android/content/ComponentName.java +++ b/core/java/android/content/ComponentName.java @@ -18,6 +18,7 @@ package android.content; import android.os.Parcel; import android.os.Parcelable; +import java.lang.Comparable; /** * Identifier for a specific application component @@ -29,7 +30,7 @@ import android.os.Parcelable; * name inside of that package. * */ -public final class ComponentName implements Parcelable { +public final class ComponentName implements Parcelable, Comparable<ComponentName> { private final String mPackage; private final String mClass; @@ -196,6 +197,15 @@ public final class ComponentName implements Parcelable { public int hashCode() { return mPackage.hashCode() + mClass.hashCode(); } + + public int compareTo(ComponentName that) { + int v; + v = this.mPackage.compareTo(that.mPackage); + if (v != 0) { + return v; + } + return this.mClass.compareTo(that.mClass); + } public int describeContents() { return 0; |