Stay organized with collections
Save and categorize content based on your preferences.
Measure
open class Measure
Known Direct Subclasses
CurrencyAmount |
An amount of currency, consisting of a Number and a Currency.
|
|
An amount of a specified unit, consisting of a Number and a Unit. For example, a length measure consists of a Number and a length unit, such as feet or meters.
Measure objects are parsed and formatted by subclasses of MeasureFormat.
Measure objects are immutable. All subclasses must guarantee that. (However, subclassing is discouraged.)
Summary
Public constructors |
Constructs a new object given a number and a unit.
|
Public methods |
open Boolean |
Returns true if the given object is equal to this object.
|
open Number! |
Returns the numeric value of this object.
|
open MeasureUnit! |
Returns the unit of this object.
|
open Int |
Returns a hashcode for this object.
|
open String |
Returns a string representation of this object.
|
Public constructors
Measure
Measure(
number: Number!,
unit: MeasureUnit!)
Constructs a new object given a number and a unit.
Public methods
equals
open fun equals(other: Any?): Boolean
Returns true if the given object is equal to this object.
Parameters |
obj |
the reference object with which to compare. |
Return |
Boolean |
true if this object is equal to the given object |
getNumber
open fun getNumber(): Number!
Returns the numeric value of this object.
Return |
Number! |
this object's Number |
getUnit
open fun getUnit(): MeasureUnit!
Returns the unit of this object.
hashCode
open fun hashCode(): Int
Returns a hashcode for this object.
toString
open fun toString(): String
Returns a string representation of this object.
Return |
String |
a string representation consisting of the ISO currency code together with the numeric amount |
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,["# Measure\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nMeasure\n=======\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/icu/util/Measure \"View this page in Java\") \n\n```\nopen class Measure\n```\n\n|---|-------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.icu.util.Measure](#) |\n\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Direct Subclasses [CurrencyAmount](/reference/kotlin/android/icu/util/CurrencyAmount) |---------------------------------------------------------------------|---------------------------------------------------------------| | [CurrencyAmount](/reference/kotlin/android/icu/util/CurrencyAmount) | An amount of currency, consisting of a Number and a Currency. | |\n\nAn amount of a specified unit, consisting of a Number and a Unit. For example, a length measure consists of a Number and a length unit, such as feet or meters.\n\nMeasure objects are parsed and formatted by subclasses of MeasureFormat.\n\nMeasure objects are immutable. All subclasses must guarantee that. (However, subclassing is discouraged.)\n\nSummary\n-------\n\n| Public constructors ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [Measure](#Measure(kotlin.Number,%20android.icu.util.MeasureUnit))`(`number:` `[Number](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-number/index.html)!`, `unit:` `[MeasureUnit](/reference/kotlin/android/icu/util/MeasureUnit)!`)` Constructs a new object given a number and a unit. |\n\n| Public methods ||\n|-----------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [equals](#equals(kotlin.Any))`(`other:` `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?`)` Returns true if the given object is equal to this object. |\n| open [Number](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-number/index.html)! | [getNumber](#getNumber())`()` Returns the numeric value of this object. |\n| open [MeasureUnit](/reference/kotlin/android/icu/util/MeasureUnit)! | [getUnit](#getUnit())`()` Returns the unit of this object. |\n| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [hashCode](#hashCode())`()` Returns a hashcode for this object. |\n| open [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [toString](#toString())`()` Returns a string representation of this object. |\n\nPublic constructors\n-------------------\n\n### Measure\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nMeasure(\n number: Number!, \n unit: MeasureUnit!)\n```\n\nConstructs a new object given a number and a unit.\n\n| Parameters ||\n|----------|-----------------------------------------------------------------------------------------------|\n| `number` | [Number](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-number/index.html)!: the number |\n| `unit` | [MeasureUnit](/reference/kotlin/android/icu/util/MeasureUnit)!: the unit |\n\nPublic methods\n--------------\n\n### equals\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun equals(other: Any?): Boolean\n```\n\nReturns true if the given object is equal to this object.\n\n| Parameters ||\n|-------|---------------------------------------------|\n| `obj` | the reference object with which to compare. |\n\n| Return ||\n|------------------------------------------------------------------------------------|--------------------------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | true if this object is equal to the given object |\n\n### getNumber\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getNumber(): Number!\n```\n\nReturns the numeric value of this object.\n\n| Return ||\n|-----------------------------------------------------------------------------------|----------------------|\n| [Number](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-number/index.html)! | this object's Number |\n\n### getUnit\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getUnit(): MeasureUnit!\n```\n\nReturns the unit of this object.\n\n| Return ||\n|----------------------------------------------------------------|--------------------|\n| [MeasureUnit](/reference/kotlin/android/icu/util/MeasureUnit)! | this object's Unit |\n\n### hashCode\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun hashCode(): Int\n```\n\nReturns a hashcode for this object.\n\n| Return ||\n|----------------------------------------------------------------------------|---------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | a 32-bit hash |\n\n### toString\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun toString(): String\n```\n\nReturns a string representation of this object.\n\n| Return ||\n|----------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------|\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | a string representation consisting of the ISO currency code together with the numeric amount |"]]