Condividi tramite


IInstantSource.Fixed(Instant) Method

Definition

Obtains a source that always returns the same instant.

[Android.Runtime.Register("fixed", "(Ljava/time/Instant;)Ljava/time/InstantSource;", "", ApiSince=34)]
public static Java.Time.IInstantSource? Fixed (Java.Time.Instant? fixedInstant);
[<Android.Runtime.Register("fixed", "(Ljava/time/Instant;)Ljava/time/InstantSource;", "", ApiSince=34)>]
static member Fixed : Java.Time.Instant -> Java.Time.IInstantSource

Parameters

fixedInstant
Instant

the instant to use, not null

Returns

a source that always returns the same instant, not null

Attributes

Remarks

Obtains a source that always returns the same instant.

This source simply returns the specified instant. As such, it is not a source that represents the current instant. The main use case for this is in testing, where the fixed source ensures tests are not dependent on the current source.

The returned implementation is immutable, thread-safe and Serializable.

Java documentation for java.time.InstantSource.fixed(java.time.Instant).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to