Most visited

Recently visited

Added in API level 24

MeasureUnit

public class MeasureUnit
extends Object implements Serializable

java.lang.Object
   ↳ android.icu.util.MeasureUnit
Known Direct Subclasses


A unit such as length, mass, volume, currency, etc. A unit is coupled with a numeric amount to produce a Measure. MeasureUnit objects are immutable. All subclasses must guarantee that. (However, subclassing is discouraged.)

See also:

Summary

Fields

public static final MeasureUnit ACRE

Constant for unit of area: acre

public static final MeasureUnit ACRE_FOOT

Constant for unit of volume: acre-foot

public static final MeasureUnit AMPERE

Constant for unit of electric: ampere

public static final MeasureUnit ARC_MINUTE

Constant for unit of angle: arc-minute

public static final MeasureUnit ARC_SECOND

Constant for unit of angle: arc-second

public static final MeasureUnit ASTRONOMICAL_UNIT

Constant for unit of length: astronomical-unit

public static final MeasureUnit BIT

Constant for unit of digital: bit

public static final MeasureUnit BUSHEL

Constant for unit of volume: bushel

public static final MeasureUnit BYTE

Constant for unit of digital: byte

public static final MeasureUnit CALORIE

Constant for unit of energy: calorie

public static final MeasureUnit CARAT

Constant for unit of mass: carat

public static final MeasureUnit CELSIUS

Constant for unit of temperature: celsius

public static final MeasureUnit CENTILITER

Constant for unit of volume: centiliter

public static final MeasureUnit CENTIMETER

Constant for unit of length: centimeter

public static final MeasureUnit CUBIC_CENTIMETER

Constant for unit of volume: cubic-centimeter

public static final MeasureUnit CUBIC_FOOT

Constant for unit of volume: cubic-foot

public static final MeasureUnit CUBIC_INCH

Constant for unit of volume: cubic-inch

public static final MeasureUnit CUBIC_KILOMETER

Constant for unit of volume: cubic-kilometer

public static final MeasureUnit CUBIC_METER

Constant for unit of volume: cubic-meter

public static final MeasureUnit CUBIC_MILE

Constant for unit of volume: cubic-mile

public static final MeasureUnit CUBIC_YARD

Constant for unit of volume: cubic-yard

public static final MeasureUnit CUP

Constant for unit of volume: cup

public static final TimeUnit DAY

Constant for unit of duration: day

public static final MeasureUnit DECILITER

Constant for unit of volume: deciliter

public static final MeasureUnit DECIMETER

Constant for unit of length: decimeter

public static final MeasureUnit DEGREE

Constant for unit of angle: degree

public static final MeasureUnit FAHRENHEIT

Constant for unit of temperature: fahrenheit

public static final MeasureUnit FATHOM

Constant for unit of length: fathom

public static final MeasureUnit FLUID_OUNCE

Constant for unit of volume: fluid-ounce

public static final MeasureUnit FOODCALORIE

Constant for unit of energy: foodcalorie

public static final MeasureUnit FOOT

Constant for unit of length: foot

public static final MeasureUnit FURLONG

Constant for unit of length: furlong

public static final MeasureUnit GALLON

Constant for unit of volume: gallon

public static final MeasureUnit GIGABIT

Constant for unit of digital: gigabit

public static final MeasureUnit GIGABYTE

Constant for unit of digital: gigabyte

public static final MeasureUnit GIGAHERTZ

Constant for unit of frequency: gigahertz

public static final MeasureUnit GIGAWATT

Constant for unit of power: gigawatt

public static final MeasureUnit GRAM

Constant for unit of mass: gram

public static final MeasureUnit G_FORCE

Constant for unit of acceleration: g-force

public static final MeasureUnit HECTARE

Constant for unit of area: hectare

public static final MeasureUnit HECTOLITER

Constant for unit of volume: hectoliter

public static final MeasureUnit HECTOPASCAL

Constant for unit of pressure: hectopascal

public static final MeasureUnit HERTZ

Constant for unit of frequency: hertz

public static final MeasureUnit HORSEPOWER

Constant for unit of power: horsepower

public static final TimeUnit HOUR

Constant for unit of duration: hour

public static final MeasureUnit INCH

Constant for unit of length: inch

public static final MeasureUnit INCH_HG

Constant for unit of pressure: inch-hg

public static final MeasureUnit JOULE

Constant for unit of energy: joule

public static final MeasureUnit KARAT

Constant for unit of proportion: karat

public static final MeasureUnit KELVIN

Constant for unit of temperature: kelvin

public static final MeasureUnit KILOBIT

Constant for unit of digital: kilobit

public static final MeasureUnit KILOBYTE

Constant for unit of digital: kilobyte

public static final MeasureUnit KILOCALORIE

Constant for unit of energy: kilocalorie

public static final MeasureUnit KILOGRAM

Constant for unit of mass: kilogram

public static final MeasureUnit KILOHERTZ

Constant for unit of frequency: kilohertz

public static final MeasureUnit KILOJOULE

Constant for unit of energy: kilojoule

public static final MeasureUnit KILOMETER

Constant for unit of length: kilometer

public static final MeasureUnit KILOMETER_PER_HOUR

Constant for unit of speed: kilometer-per-hour

public static final MeasureUnit KILOWATT

Constant for unit of power: kilowatt

public static final MeasureUnit KILOWATT_HOUR

Constant for unit of energy: kilowatt-hour

public static final MeasureUnit LIGHT_YEAR

Constant for unit of length: light-year

public static final MeasureUnit LITER

Constant for unit of volume: liter

public static final MeasureUnit LITER_PER_KILOMETER

Constant for unit of consumption: liter-per-kilometer

public static final MeasureUnit LUX

Constant for unit of light: lux

public static final MeasureUnit MEGABIT

Constant for unit of digital: megabit

public static final MeasureUnit MEGABYTE

Constant for unit of digital: megabyte

public static final MeasureUnit MEGAHERTZ

Constant for unit of frequency: megahertz

public static final MeasureUnit MEGALITER

Constant for unit of volume: megaliter

public static final MeasureUnit MEGAWATT

Constant for unit of power: megawatt

public static final MeasureUnit METER

Constant for unit of length: meter

public static final MeasureUnit METER_PER_SECOND

Constant for unit of speed: meter-per-second

public static final MeasureUnit METER_PER_SECOND_SQUARED

Constant for unit of acceleration: meter-per-second-squared

public static final MeasureUnit METRIC_TON

Constant for unit of mass: metric-ton

public static final MeasureUnit MICROGRAM

Constant for unit of mass: microgram

public static final MeasureUnit MICROMETER

Constant for unit of length: micrometer

public static final MeasureUnit MICROSECOND

Constant for unit of duration: microsecond

public static final MeasureUnit MILE

Constant for unit of length: mile

public static final MeasureUnit MILE_PER_GALLON

Constant for unit of consumption: mile-per-gallon

public static final MeasureUnit MILE_PER_HOUR

Constant for unit of speed: mile-per-hour

public static final MeasureUnit MILLIAMPERE

Constant for unit of electric: milliampere

public static final MeasureUnit MILLIBAR

Constant for unit of pressure: millibar

public static final MeasureUnit MILLIGRAM

Constant for unit of mass: milligram

public static final MeasureUnit MILLILITER

Constant for unit of volume: milliliter

public static final MeasureUnit MILLIMETER

Constant for unit of length: millimeter

public static final MeasureUnit MILLIMETER_OF_MERCURY

Constant for unit of pressure: millimeter-of-mercury

public static final MeasureUnit MILLISECOND

Constant for unit of duration: millisecond

public static final MeasureUnit MILLIWATT

Constant for unit of power: milliwatt

public static final TimeUnit MINUTE

Constant for unit of duration: minute

public static final TimeUnit MONTH

Constant for unit of duration: month

public static final MeasureUnit NANOMETER

Constant for unit of length: nanometer

public static final MeasureUnit NANOSECOND

Constant for unit of duration: nanosecond

public static final MeasureUnit NAUTICAL_MILE

Constant for unit of length: nautical-mile

public static final MeasureUnit OHM

Constant for unit of electric: ohm

public static final MeasureUnit OUNCE

Constant for unit of mass: ounce

public static final MeasureUnit OUNCE_TROY

Constant for unit of mass: ounce-troy

public static final MeasureUnit PARSEC

Constant for unit of length: parsec

public static final MeasureUnit PICOMETER

Constant for unit of length: picometer

public static final MeasureUnit PINT

Constant for unit of volume: pint

public static final MeasureUnit POUND

Constant for unit of mass: pound

public static final MeasureUnit POUND_PER_SQUARE_INCH

Constant for unit of pressure: pound-per-square-inch

public static final MeasureUnit QUART

Constant for unit of volume: quart

public static final MeasureUnit RADIAN

Constant for unit of angle: radian

public static final TimeUnit SECOND

Constant for unit of duration: second

public static final MeasureUnit SQUARE_CENTIMETER

Constant for unit of area: square-centimeter

public static final MeasureUnit SQUARE_FOOT

Constant for unit of area: square-foot

public static final MeasureUnit SQUARE_INCH

Constant for unit of area: square-inch

public static final MeasureUnit SQUARE_KILOMETER

Constant for unit of area: square-kilometer

public static final MeasureUnit SQUARE_METER

Constant for unit of area: square-meter

public static final MeasureUnit SQUARE_MILE

Constant for unit of area: square-mile

public static final MeasureUnit SQUARE_YARD

Constant for unit of area: square-yard

public static final MeasureUnit STONE

Constant for unit of mass: stone

public static final MeasureUnit TABLESPOON

Constant for unit of volume: tablespoon

public static final MeasureUnit TEASPOON

Constant for unit of volume: teaspoon

public static final MeasureUnit TERABIT

Constant for unit of digital: terabit

public static final MeasureUnit TERABYTE

Constant for unit of digital: terabyte

public static final MeasureUnit TON

Constant for unit of mass: ton

public static final MeasureUnit VOLT

Constant for unit of electric: volt

public static final MeasureUnit WATT

Constant for unit of power: watt

public static final TimeUnit WEEK

Constant for unit of duration: week

public static final MeasureUnit YARD

Constant for unit of length: yard

public static final TimeUnit YEAR

Constant for unit of duration: year

Public methods

boolean equals(Object rhs)

Indicates whether some other object is "equal to" this one.

static Set<MeasureUnit> getAvailable()

Get all of the available units.

static Set<MeasureUnit> getAvailable(String type)

For the given type, return the available units.

static Set<String> getAvailableTypes()

Get all of the available units' types.

String getSubtype()

Get the subType, such as “foot”.

String getType()

Get the type, such as "length"

int hashCode()

Returns a hash code value for the object.

String toString()

Returns a string representation of the object.

Inherited methods

From class java.lang.Object

Fields

ACRE

Added in API level 24
MeasureUnit ACRE

Constant for unit of area: acre

ACRE_FOOT

Added in API level 24
MeasureUnit ACRE_FOOT

Constant for unit of volume: acre-foot

AMPERE

Added in API level 24
MeasureUnit AMPERE

Constant for unit of electric: ampere

ARC_MINUTE

Added in API level 24
MeasureUnit ARC_MINUTE

Constant for unit of angle: arc-minute

ARC_SECOND

Added in API level 24
MeasureUnit ARC_SECOND

Constant for unit of angle: arc-second

ASTRONOMICAL_UNIT

Added in API level 24
MeasureUnit ASTRONOMICAL_UNIT

Constant for unit of length: astronomical-unit

BIT

Added in API level 24
MeasureUnit BIT

Constant for unit of digital: bit

BUSHEL

Added in API level 24
MeasureUnit BUSHEL

Constant for unit of volume: bushel

BYTE

Added in API level 24
MeasureUnit BYTE

Constant for unit of digital: byte

CALORIE

Added in API level 24
MeasureUnit CALORIE

Constant for unit of energy: calorie

CARAT

Added in API level 24
MeasureUnit CARAT

Constant for unit of mass: carat

CELSIUS

Added in API level 24
MeasureUnit CELSIUS

Constant for unit of temperature: celsius

CENTILITER

Added in API level 24
MeasureUnit CENTILITER

Constant for unit of volume: centiliter

CENTIMETER

Added in API level 24
MeasureUnit CENTIMETER

Constant for unit of length: centimeter

CUBIC_CENTIMETER

Added in API level 24
MeasureUnit CUBIC_CENTIMETER

Constant for unit of volume: cubic-centimeter

CUBIC_FOOT

Added in API level 24
MeasureUnit CUBIC_FOOT

Constant for unit of volume: cubic-foot

CUBIC_INCH

Added in API level 24
MeasureUnit CUBIC_INCH

Constant for unit of volume: cubic-inch

CUBIC_KILOMETER

Added in API level 24
MeasureUnit CUBIC_KILOMETER

Constant for unit of volume: cubic-kilometer

CUBIC_METER

Added in API level 24
MeasureUnit CUBIC_METER

Constant for unit of volume: cubic-meter

CUBIC_MILE

Added in API level 24
MeasureUnit CUBIC_MILE

Constant for unit of volume: cubic-mile

CUBIC_YARD

Added in API level 24
MeasureUnit CUBIC_YARD

Constant for unit of volume: cubic-yard

CUP

Added in API level 24
MeasureUnit CUP

Constant for unit of volume: cup

DAY

Added in API level 24
TimeUnit DAY

Constant for unit of duration: day

DECILITER

Added in API level 24
MeasureUnit DECILITER

Constant for unit of volume: deciliter

DECIMETER

Added in API level 24
MeasureUnit DECIMETER

Constant for unit of length: decimeter

DEGREE

Added in API level 24
MeasureUnit DEGREE

Constant for unit of angle: degree

FAHRENHEIT

Added in API level 24
MeasureUnit FAHRENHEIT

Constant for unit of temperature: fahrenheit

FATHOM

Added in API level 24
MeasureUnit FATHOM

Constant for unit of length: fathom

FLUID_OUNCE

Added in API level 24
MeasureUnit FLUID_OUNCE

Constant for unit of volume: fluid-ounce

FOODCALORIE

Added in API level 24
MeasureUnit FOODCALORIE

Constant for unit of energy: foodcalorie

FOOT

Added in API level 24
MeasureUnit FOOT

Constant for unit of length: foot

FURLONG

Added in API level 24
MeasureUnit FURLONG

Constant for unit of length: furlong

GALLON

Added in API level 24
MeasureUnit GALLON

Constant for unit of volume: gallon

GIGABIT

Added in API level 24
MeasureUnit GIGABIT

Constant for unit of digital: gigabit

GIGABYTE

Added in API level 24
MeasureUnit GIGABYTE

Constant for unit of digital: gigabyte

GIGAHERTZ

Added in API level 24
MeasureUnit GIGAHERTZ

Constant for unit of frequency: gigahertz

GIGAWATT

Added in API level 24
MeasureUnit GIGAWATT

Constant for unit of power: gigawatt

GRAM

Added in API level 24
MeasureUnit GRAM

Constant for unit of mass: gram

G_FORCE

Added in API level 24
MeasureUnit G_FORCE

Constant for unit of acceleration: g-force

HECTARE

Added in API level 24
MeasureUnit HECTARE

Constant for unit of area: hectare

HECTOLITER

Added in API level 24
MeasureUnit HECTOLITER

Constant for unit of volume: hectoliter

HECTOPASCAL

Added in API level 24
MeasureUnit HECTOPASCAL

Constant for unit of pressure: hectopascal

HERTZ

Added in API level 24
MeasureUnit HERTZ

Constant for unit of frequency: hertz

HORSEPOWER

Added in API level 24
MeasureUnit HORSEPOWER

Constant for unit of power: horsepower

HOUR

Added in API level 24
TimeUnit HOUR

Constant for unit of duration: hour

INCH

Added in API level 24
MeasureUnit INCH

Constant for unit of length: inch

INCH_HG

Added in API level 24
MeasureUnit INCH_HG

Constant for unit of pressure: inch-hg

JOULE

Added in API level 24
MeasureUnit JOULE

Constant for unit of energy: joule

KARAT

Added in API level 24
MeasureUnit KARAT

Constant for unit of proportion: karat

KELVIN

Added in API level 24
MeasureUnit KELVIN

Constant for unit of temperature: kelvin

KILOBIT

Added in API level 24
MeasureUnit KILOBIT

Constant for unit of digital: kilobit

KILOBYTE

Added in API level 24
MeasureUnit KILOBYTE

Constant for unit of digital: kilobyte

KILOCALORIE

Added in API level 24
MeasureUnit KILOCALORIE

Constant for unit of energy: kilocalorie

KILOGRAM

Added in API level 24
MeasureUnit KILOGRAM

Constant for unit of mass: kilogram

KILOHERTZ

Added in API level 24
MeasureUnit KILOHERTZ

Constant for unit of frequency: kilohertz

KILOJOULE

Added in API level 24
MeasureUnit KILOJOULE

Constant for unit of energy: kilojoule

KILOMETER

Added in API level 24
MeasureUnit KILOMETER

Constant for unit of length: kilometer

KILOMETER_PER_HOUR

Added in API level 24
MeasureUnit KILOMETER_PER_HOUR

Constant for unit of speed: kilometer-per-hour

KILOWATT

Added in API level 24
MeasureUnit KILOWATT

Constant for unit of power: kilowatt

KILOWATT_HOUR

Added in API level 24
MeasureUnit KILOWATT_HOUR

Constant for unit of energy: kilowatt-hour

LIGHT_YEAR

Added in API level 24
MeasureUnit LIGHT_YEAR

Constant for unit of length: light-year

LITER

Added in API level 24
MeasureUnit LITER

Constant for unit of volume: liter

LITER_PER_KILOMETER

Added in API level 24
MeasureUnit LITER_PER_KILOMETER

Constant for unit of consumption: liter-per-kilometer

LUX

Added in API level 24
MeasureUnit LUX

Constant for unit of light: lux

MEGABIT

Added in API level 24
MeasureUnit MEGABIT

Constant for unit of digital: megabit

MEGABYTE

Added in API level 24
MeasureUnit MEGABYTE

Constant for unit of digital: megabyte

MEGAHERTZ

Added in API level 24
MeasureUnit MEGAHERTZ

Constant for unit of frequency: megahertz

MEGALITER

Added in API level 24
MeasureUnit MEGALITER

Constant for unit of volume: megaliter

MEGAWATT

Added in API level 24
MeasureUnit MEGAWATT

Constant for unit of power: megawatt

METER

Added in API level 24
MeasureUnit METER

Constant for unit of length: meter

METER_PER_SECOND

Added in API level 24
MeasureUnit METER_PER_SECOND

Constant for unit of speed: meter-per-second

METER_PER_SECOND_SQUARED

Added in API level 24
MeasureUnit METER_PER_SECOND_SQUARED

Constant for unit of acceleration: meter-per-second-squared

METRIC_TON

Added in API level 24
MeasureUnit METRIC_TON

Constant for unit of mass: metric-ton

MICROGRAM

Added in API level 24
MeasureUnit MICROGRAM

Constant for unit of mass: microgram

MICROMETER

Added in API level 24
MeasureUnit MICROMETER

Constant for unit of length: micrometer

MICROSECOND

Added in API level 24
MeasureUnit MICROSECOND

Constant for unit of duration: microsecond

MILE

Added in API level 24
MeasureUnit MILE

Constant for unit of length: mile

MILE_PER_GALLON

Added in API level 24
MeasureUnit MILE_PER_GALLON

Constant for unit of consumption: mile-per-gallon

MILE_PER_HOUR

Added in API level 24
MeasureUnit MILE_PER_HOUR

Constant for unit of speed: mile-per-hour

MILLIAMPERE

Added in API level 24
MeasureUnit MILLIAMPERE

Constant for unit of electric: milliampere

MILLIBAR

Added in API level 24
MeasureUnit MILLIBAR

Constant for unit of pressure: millibar

MILLIGRAM

Added in API level 24
MeasureUnit MILLIGRAM

Constant for unit of mass: milligram

MILLILITER

Added in API level 24
MeasureUnit MILLILITER

Constant for unit of volume: milliliter

MILLIMETER

Added in API level 24
MeasureUnit MILLIMETER

Constant for unit of length: millimeter

MILLIMETER_OF_MERCURY

Added in API level 24
MeasureUnit MILLIMETER_OF_MERCURY

Constant for unit of pressure: millimeter-of-mercury

MILLISECOND

Added in API level 24
MeasureUnit MILLISECOND

Constant for unit of duration: millisecond

MILLIWATT

Added in API level 24
MeasureUnit MILLIWATT

Constant for unit of power: milliwatt

MINUTE

Added in API level 24
TimeUnit MINUTE

Constant for unit of duration: minute

MONTH

Added in API level 24
TimeUnit MONTH

Constant for unit of duration: month

NANOMETER

Added in API level 24
MeasureUnit NANOMETER

Constant for unit of length: nanometer

NANOSECOND

Added in API level 24
MeasureUnit NANOSECOND

Constant for unit of duration: nanosecond

NAUTICAL_MILE

Added in API level 24
MeasureUnit NAUTICAL_MILE

Constant for unit of length: nautical-mile

OHM

Added in API level 24
MeasureUnit OHM

Constant for unit of electric: ohm

OUNCE

Added in API level 24
MeasureUnit OUNCE

Constant for unit of mass: ounce

OUNCE_TROY

Added in API level 24
MeasureUnit OUNCE_TROY

Constant for unit of mass: ounce-troy

PARSEC

Added in API level 24
MeasureUnit PARSEC

Constant for unit of length: parsec

PICOMETER

Added in API level 24
MeasureUnit PICOMETER

Constant for unit of length: picometer

PINT

Added in API level 24
MeasureUnit PINT

Constant for unit of volume: pint

POUND

Added in API level 24
MeasureUnit POUND

Constant for unit of mass: pound

POUND_PER_SQUARE_INCH

Added in API level 24
MeasureUnit POUND_PER_SQUARE_INCH

Constant for unit of pressure: pound-per-square-inch

QUART

Added in API level 24
MeasureUnit QUART

Constant for unit of volume: quart

RADIAN

Added in API level 24
MeasureUnit RADIAN

Constant for unit of angle: radian

SECOND

Added in API level 24
TimeUnit SECOND

Constant for unit of duration: second

SQUARE_CENTIMETER

Added in API level 24
MeasureUnit SQUARE_CENTIMETER

Constant for unit of area: square-centimeter

SQUARE_FOOT

Added in API level 24
MeasureUnit SQUARE_FOOT

Constant for unit of area: square-foot

SQUARE_INCH

Added in API level 24
MeasureUnit SQUARE_INCH

Constant for unit of area: square-inch

SQUARE_KILOMETER

Added in API level 24
MeasureUnit SQUARE_KILOMETER

Constant for unit of area: square-kilometer

SQUARE_METER

Added in API level 24
MeasureUnit SQUARE_METER

Constant for unit of area: square-meter

SQUARE_MILE

Added in API level 24
MeasureUnit SQUARE_MILE

Constant for unit of area: square-mile

SQUARE_YARD

Added in API level 24
MeasureUnit SQUARE_YARD

Constant for unit of area: square-yard

STONE

Added in API level 24
MeasureUnit STONE

Constant for unit of mass: stone

TABLESPOON

Added in API level 24
MeasureUnit TABLESPOON

Constant for unit of volume: tablespoon

TEASPOON

Added in API level 24
MeasureUnit TEASPOON

Constant for unit of volume: teaspoon

TERABIT

Added in API level 24
MeasureUnit TERABIT

Constant for unit of digital: terabit

TERABYTE

Added in API level 24
MeasureUnit TERABYTE

Constant for unit of digital: terabyte

TON

Added in API level 24
MeasureUnit TON

Constant for unit of mass: ton

VOLT

Added in API level 24
MeasureUnit VOLT

Constant for unit of electric: volt

WATT

Added in API level 24
MeasureUnit WATT

Constant for unit of power: watt

WEEK

Added in API level 24
TimeUnit WEEK

Constant for unit of duration: week

YARD

Added in API level 24
MeasureUnit YARD

Constant for unit of length: yard

YEAR

Added in API level 24
TimeUnit YEAR

Constant for unit of duration: year

Public methods

equals

Added in API level 24
boolean equals (Object rhs)

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any non-null reference values x and y, this method returns true if and only if x and y refer to the same object (x == y has the value true).

Note that it is generally necessary to override the hashCode method whenever this method is overridden, so as to maintain the general contract for the hashCode method, which states that equal objects must have equal hash codes.

Parameters
rhs Object: the reference object with which to compare.
Returns
boolean true if this object is the same as the obj argument; false otherwise.

getAvailable

Added in API level 24
Set<MeasureUnit> getAvailable ()

Get all of the available units. Returned set is unmodifiable.

Returns
Set<MeasureUnit>

getAvailable

Added in API level 24
Set<MeasureUnit> getAvailable (String type)

For the given type, return the available units.

Parameters
type String: the type
Returns
Set<MeasureUnit> the available units for type. Returned set is unmodifiable.

getAvailableTypes

Added in API level 24
Set<String> getAvailableTypes ()

Get all of the available units' types. Returned set is unmodifiable.

Returns
Set<String>

getSubtype

Added in API level 24
String getSubtype ()

Get the subType, such as “foot”.

Returns
String

getType

Added in API level 24
String getType ()

Get the type, such as "length"

Returns
String

hashCode

Added in API level 24
int hashCode ()

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals(java.lang.Object) method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the JavaTM programming language.)

Returns
int a hash code value for this object.

toString

Added in API level 24
String toString ()

Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Returns
String a string representation of the object.

Hooray!