Marcel truth

A truthy value is a value that is considered to be true for an if, or a while.

A falsey value is a value that is considered false in those places.

The only falsey values are the following:

  • false
  • null
  • a Boolean instance whose value is false
  • Optional.empty(), OptionalInt.empty(), OptionalDouble.empty(), OptionalLong.empty()
  • An empty collection
  • An empty array
  • An empty Map
  • An empty String
  • A Matcher who's find() method would return false
  • A File who's exists() method would return false
  • An object implementing MarcelTruth who's isTruthy() method would return false

Any other value is truthy.