public final class Length implements Comparable


Represents a unit of length. Supported units: meters, kilometers, miles, inches and feet.

Summary

Public methods

int
boolean
equals(Object other)
static final @NonNull Length
feet(double value)

Creates Length with the specified value in feet.

final double

Returns the length in feet.

final double

Returns the length in inches.

final double

Returns the length in kilometers.

final double

Returns the length in meters.

final double

Returns the length in miles.

int
static final @NonNull Length
inches(double value)

Creates Length with the specified value in inches.

static final @NonNull Length
kilometers(double value)

Creates Length with the specified value in kilometers.

static final @NonNull Length
meters(double value)

Creates Length with the specified value in meters.

static final @NonNull Length
miles(double value)

Creates Length with the specified value in miles.

@NonNull String

Public methods

compareTo

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

equals

public boolean equals(Object other)

feet

Added in 1.1.0-alpha10
public static final @NonNull Length feet(double value)

Creates Length with the specified value in feet.

getFeet

Added in 1.1.0-alpha10
public final double getFeet()

Returns the length in feet.

getInches

Added in 1.1.0-alpha10
public final double getInches()

Returns the length in inches.

getKilometers

Added in 1.1.0-alpha10
public final double getKilometers()

Returns the length in kilometers.

getMeters

Added in 1.1.0-alpha10
public final double getMeters()

Returns the length in meters.

getMiles

Added in 1.1.0-alpha10
public final double getMiles()

Returns the length in miles.

hashCode

public int hashCode()

inches

Added in 1.1.0-alpha10
public static final @NonNull Length inches(double value)

Creates Length with the specified value in inches.

kilometers

Added in 1.1.0-alpha10
public static final @NonNull Length kilometers(double value)

Creates Length with the specified value in kilometers.

meters

Added in 1.1.0-alpha10
public static final @NonNull Length meters(double value)

Creates Length with the specified value in meters.

miles

Added in 1.1.0-alpha10
public static final @NonNull Length miles(double value)

Creates Length with the specified value in miles.

toString

public @NonNull String toString()