A time source; returns a time value representing the number of nanoseconds elapsed since some fixed but arbitrary point in time.
A time source; returns a time value representing the number of nanoseconds elapsed since some
fixed but arbitrary point in time. Note that most users should use Stopwatch
instead of
interacting with this class directly.
Warning: this interface can only be used to measure elapsed time, not wall time.
0.7 (copied from guava-libraries)
Utility functions to convert from Scala Equiv[T]
to Guava Equivalence[T]
and vice versa.
Utility functions to convert from Scala Equiv[T]
to Guava Equivalence[T]
and vice versa.
Usage example for conversion between Guava and Mango:
import org.feijoas.mango.common.base.Equivalence._ // convert a Guava Equivalence[T] to a Scala Equiv[T] val guava: gcm.Equivalence[T] = ... val mango: Equiv[T] = guava.asScala // convert a Scala Equiv[T] to a Guava Equivalence[T] val mango: Equiv[T] = ... val guava: gcm.Equivalence[T] = mango.asJava
0.10
Utility functions for the work with Guava Function[T, R]
Utility functions for the work with Guava Function[T, R]
Usage example for conversion between Guava and Mango:
// convert a Guava function to a Scala function val fnc: Function[T, R] = { (arg: T) => ... }.asJava // convert a Scala function to a Guava function val fnc: (T => R) = SomeGuavaFunction.asScala // convert a Scala function to a Callable val callable: Callable[R] = { () => n }.asJava // convert a Scala functio to a Runnable val runnable: Runnable = { () => ... }.asJava
0.7
Utility functions for the work with Option[T]
and Optional[T]
Utility functions for the work with Option[T]
and Optional[T]
Usage example for conversion between Guava and Mango:
// convert a Guava Optional[T] to a Scala Option[T] Optional.of("some").asScala Optional.absent().asScala // convert a Scala Option[T] to a Guava Optional[T] Some("some").asJava None.asJava
0.7
Simple static methods to be called at the start of your own methods to verify correct arguments and state.
Simple static methods to be called at the start of your own methods to verify correct arguments and state. This allows constructs such as
if (count <= 0) { throw new IllegalArgumentException("must be positive: " + count) }
to be replaced with the more compact
checkArgument(count > 0, "must be positive: %s", count)
Note that the sense of the expression is inverted with Preconditions
you declare what you expect to be true, just as you do with an
assert
or a JUnit assertTrue
call.
Warning: only the "%s"
specifier is recognized as a
placeholder in these messages.
Take care not to confuse precondition checking with other similar types
of checks! Precondition exceptions -- including those provided here, but also
IndexOutOfBoundsException
, NoSuchElementException
, UnsupportedOperationException
and others -- are used to signal that the
calling method has made an error. This tells the caller that it should
not have invoked the method when it did, with the arguments it did, or
perhaps ever. Postcondition or other invariant failures should not throw
these types of exceptions.
See also the Guava User Guide on using Preconditions
0.7 (copied from guava-libraries)
Utility functions for the work with Guava Predicate[T]
Utility functions for the work with Guava Predicate[T]
Usage example for conversion between Guava and Mango:
// convert a Guava Predicate[T] to a Scala function T => Boolean import com.google.common.base.{ Predicate => GuavaPredicate } val pred: GuavaPredicate[Any] = { (arg: Any) => true }.asJava // convert a Scala function T => Boolean to a Guava Predicate[T] import com.google.common.base.{ Predicates => GuavaPredicates } val pred: Any => Boolean = GuavaPredicates.alwaysTrue().asScala
0.7
Utility functions for the work with suppliers which are functions of
the type () => T
Utility functions for the work with suppliers which are functions of
the type () => T
Usage example for conversion between Guava and Mango:
// convert a Guava Supplier[T] to a Scala function () => T import com.google.common.base.{ Supplier => GuavaSupplier } val fnc: () => T = ... val supplier: GuavaSupplier[T] = fnc.asJava // convert a Scala function () => T to a Guava Supplier[T] val guavaSupplier: GuavaSupplier[T] = ... val supplier: () => T = guavaSupplier.asScala
0.7
Factory for Ticker instances.
Basic utility libraries and interfaces.
0.7