public final class Mass implements Comparable


Represents a unit of mass. Supported units:

Summary

Public methods

int
boolean
equals(Object other)
final double

Returns the mass in grams.

final double

Returns the mass in kilograms.

final double

Returns the mass in micrograms.

final double

Returns the mass in milligrams.

final double

Returns the mass in ounces.

final double

Returns the mass in pounds.

static final @NonNull Mass
grams(double value)

Creates Mass with the specified value in grams.

int
static final @NonNull Mass
kilograms(double value)

Creates Mass with the specified value in kilograms.

static final @NonNull Mass
micrograms(double value)

Creates Mass with the specified value in micrograms.

static final @NonNull Mass
milligrams(double value)

Creates Mass with the specified value in milligrams.

static final @NonNull Mass
ounces(double value)

Creates Mass with the specified value in ounces.

static final @NonNull Mass
pounds(double value)

Creates Mass with the specified value in pounds.

@NonNull String

Public methods

compareTo

Added in 1.1.0-alpha10
public int compareTo(@NonNull Mass other)

equals

public boolean equals(Object other)

getGrams

Added in 1.1.0-alpha10
public final double getGrams()

Returns the mass in grams.

getKilograms

Added in 1.1.0-alpha10
public final double getKilograms()

Returns the mass in kilograms.

getMicrograms

Added in 1.1.0-alpha10
public final double getMicrograms()

Returns the mass in micrograms.

getMilligrams

Added in 1.1.0-alpha10
public final double getMilligrams()

Returns the mass in milligrams.

getOunces

Added in 1.1.0-alpha10
public final double getOunces()

Returns the mass in ounces.

getPounds

Added in 1.1.0-alpha10
public final double getPounds()

Returns the mass in pounds.

grams

Added in 1.1.0-alpha10
public static final @NonNull Mass grams(double value)

Creates Mass with the specified value in grams.

hashCode

public int hashCode()

kilograms

Added in 1.1.0-alpha10
public static final @NonNull Mass kilograms(double value)

Creates Mass with the specified value in kilograms.

micrograms

Added in 1.1.0-alpha10
public static final @NonNull Mass micrograms(double value)

Creates Mass with the specified value in micrograms.

milligrams

Added in 1.1.0-alpha10
public static final @NonNull Mass milligrams(double value)

Creates Mass with the specified value in milligrams.

ounces

Added in 1.1.0-alpha10
public static final @NonNull Mass ounces(double value)

Creates Mass with the specified value in ounces.

pounds

Added in 1.1.0-alpha10
public static final @NonNull Mass pounds(double value)

Creates Mass with the specified value in pounds.

toString

public @NonNull String toString()