includes method

bool includes(
  1. num comparable
)

Implementation

bool includes(num comparable) {
  // before - read as: if negative, true, if zero test for includes, if positive, false.
  int beforeMin = comparable.compareTo(min);
  int beforeMax = comparable.compareTo(max);

  // Hopefully these complications gain some minor speed,
  // dealing with the obvious cases first.
  if (beforeMin < 0 || beforeMax > 0) return false;
  if (beforeMin > 0 && beforeMax < 0) return true;
  if (beforeMin == 0 && includesMin) return true;
  if (beforeMax == 0 && includesMax) return true;

  return false;
}