public final class Energy implements Comparable


Represents a unit of energy. Supported units:

Summary

Public methods

static final @NonNull Energy
calories(double value)

Creates Energy with the specified value in calories.

int
boolean
equals(Object other)
final double

Returns the energy in calories.

final double

Returns the energy in joules.

final double

Returns the energy in kilocalories.

final double

Returns the energy in kilojoules.

int
static final @NonNull Energy
joules(double value)

Creates Energy with the specified value in joules.

static final @NonNull Energy
kilocalories(double value)

Creates Energy with the specified value in kilocalories.

static final @NonNull Energy
kilojoules(double value)

Creates Energy with the specified value in kilojoules.

@NonNull String

Public methods

calories

Added in 1.1.0-alpha10
public static final @NonNull Energy calories(double value)

Creates Energy with the specified value in calories.

compareTo

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

equals

public boolean equals(Object other)

getCalories

Added in 1.1.0-alpha10
public final double getCalories()

Returns the energy in calories.

getJoules

Added in 1.1.0-alpha10
public final double getJoules()

Returns the energy in joules.

getKilocalories

Added in 1.1.0-alpha10
public final double getKilocalories()

Returns the energy in kilocalories.

getKilojoules

Added in 1.1.0-alpha10
public final double getKilojoules()

Returns the energy in kilojoules.

hashCode

public int hashCode()

joules

Added in 1.1.0-alpha10
public static final @NonNull Energy joules(double value)

Creates Energy with the specified value in joules.

kilocalories

Added in 1.1.0-alpha10
public static final @NonNull Energy kilocalories(double value)

Creates Energy with the specified value in kilocalories.

kilojoules

Added in 1.1.0-alpha10
public static final @NonNull Energy kilojoules(double value)

Creates Energy with the specified value in kilojoules.

toString

public @NonNull String toString()