Stay organized with collections
Save and categorize content based on your preferences.
DisplayNameComparator
open class DisplayNameComparator : Comparator<ApplicationInfo!>
Summary
Public constructors
Public methods
compare
fun compare(
aa: ApplicationInfo!,
ab: ApplicationInfo!
): Int
Parameters |
o1 |
the first object to be compared. |
o2 |
the second object to be compared. |
Return |
Int |
a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second. |
Exceptions |
java.lang.NullPointerException |
if an argument is null and this comparator does not permit null arguments |
java.lang.ClassCastException |
if the arguments' types prevent them from being compared by this comparator. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# ApplicationInfo.DisplayNameComparator\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nDisplayNameComparator\n=====================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/content/pm/ApplicationInfo.DisplayNameComparator \"View this page in Java\") \n\n```\nopen class DisplayNameComparator : Comparator\u003cApplicationInfo!\u003e\n```\n\n|---|---------------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.content.pm.ApplicationInfo.DisplayNameComparator](#) |\n\nSummary\n-------\n\n| Public constructors ||\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [DisplayNameComparator](#DisplayNameComparator(android.content.pm.PackageManager))`(`pm:` `[PackageManager](/reference/kotlin/android/content/pm/PackageManager)!`)` \u003cbr /\u003e |\n\n| Public methods ||\n|----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [compare](#compare(android.content.pm.ApplicationInfo,%20android.content.pm.ApplicationInfo))`(`aa:` `[ApplicationInfo](/reference/kotlin/android/content/pm/ApplicationInfo)!`, `ab:` `[ApplicationInfo](/reference/kotlin/android/content/pm/ApplicationInfo)!`)` \u003cbr /\u003e |\n\n| Inherited functions ||\n|---|---|\n| From class [Comparator](../../../java/util/Comparator.html#) |-------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Comparator](../../../java/util/Comparator.html#)\u003cT\u003e! | [reversed](../../../java/util/Comparator.html#reversed())`()` Returns a comparator that imposes the reverse ordering of this comparator. \u003cbr /\u003e | | [Comparator](../../../java/util/Comparator.html#)\u003cT\u003e! | [thenComparing](../../../java/util/Comparator.html#thenComparing(java.util.Comparator))`(`other:` `[Comparator](../../../java/util/Comparator.html#)\u003cin` `T\u003e!`)` Returns a lexicographic-order comparator with another comparator. If this `Comparator` considers two elements equal, i.e. `compare(a, b) == 0`, `other` is used to determine the order. The returned comparator is serializable if the specified comparator is also serializable. \u003cbr /\u003e | | [Comparator](../../../java/util/Comparator.html#)\u003cT\u003e! | [thenComparing](../../../java/util/Comparator.html#thenComparing(java.util.function.Function))`(`keyExtractor:` `[Function](../../../java/util/function/Function.html#)\u003cin` `T,` `out` `U\u003e!`)` Returns a lexicographic-order comparator with a function that extracts a `Comparable` sort key. \u003cbr /\u003e | | [Comparator](../../../java/util/Comparator.html#)\u003cT\u003e! | [thenComparing](../../../java/util/Comparator.html#thenComparing(java.util.function.Function,%20java.util.Comparator))`(`keyExtractor:` `[Function](../../../java/util/function/Function.html#)\u003cin` `T,` `out` `U\u003e!`, `keyComparator:` `[Comparator](../../../java/util/Comparator.html#)\u003cin` `U\u003e!`)` Returns a lexicographic-order comparator with a function that extracts a key to be compared with the given `Comparator`. \u003cbr /\u003e | | [Comparator](../../../java/util/Comparator.html#)\u003cT\u003e! | [thenComparingDouble](../../../java/util/Comparator.html#thenComparingDouble(java.util.function.ToDoubleFunction))`(`keyExtractor:` `[ToDoubleFunction](../../../java/util/function/ToDoubleFunction.html#)\u003cin` `T\u003e!`)` Returns a lexicographic-order comparator with a function that extracts a `double` sort key. \u003cbr /\u003e | | [Comparator](../../../java/util/Comparator.html#)\u003cT\u003e! | [thenComparingInt](../../../java/util/Comparator.html#thenComparingInt(java.util.function.ToIntFunction))`(`keyExtractor:` `[ToIntFunction](../../../java/util/function/ToIntFunction.html#)\u003cin` `T\u003e!`)` Returns a lexicographic-order comparator with a function that extracts an `int` sort key. \u003cbr /\u003e | | [Comparator](../../../java/util/Comparator.html#)\u003cT\u003e! | [thenComparingLong](../../../java/util/Comparator.html#thenComparingLong(java.util.function.ToLongFunction))`(`keyExtractor:` `[ToLongFunction](../../../java/util/function/ToLongFunction.html#)\u003cin` `T\u003e!`)` Returns a lexicographic-order comparator with a function that extracts a `long` sort key. \u003cbr /\u003e | ||\n\nPublic constructors\n-------------------\n\n### DisplayNameComparator\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nDisplayNameComparator(pm: PackageManager!)\n```\n\nPublic methods\n--------------\n\n### compare\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun compare(\n aa: ApplicationInfo!, \n ab: ApplicationInfo!\n): Int\n```\n\n| Parameters ||\n|------|-----------------------------------|\n| `o1` | the first object to be compared. |\n| `o2` | the second object to be compared. |\n\n| Return ||\n|----------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second. |\n\n| Exceptions ||\n|----------------------------------|------------------------------------------------------------------------------|\n| `java.lang.NullPointerException` | if an argument is null and this comparator does not permit null arguments |\n| `java.lang.ClassCastException` | if the arguments' types prevent them from being compared by this comparator. |"]]