Java Duration Calculate isFinite(Duration duration)

Here you can find the source of isFinite(Duration duration)

Description

is Finite

License

Open Source License

Declaration

public static boolean isFinite(Duration duration) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.time.Duration;

import java.time.temporal.ChronoUnit;

public class Main {
    public static final Duration INF_POSITIVE = ChronoUnit.FOREVER.getDuration();
    public static final Duration INF_NEGATIVE = INF_POSITIVE.negated();

    public static boolean isFinite(Duration duration) {
        return !isInfPositive(duration) && !isInfNegative(duration);
    }/*from ww  w.j  av a  2s.  com*/

    public static boolean isInfPositive(Duration duration) {
        return INF_POSITIVE.equals(duration);
    }

    public static boolean isInfNegative(Duration duration) {
        return INF_NEGATIVE.equals(duration);
    }
}

Related

  1. getDurationByTimeValues(final long hours, final long minutes, final long seconds)
  2. getExpirationMillis(long now, Duration duration)
  3. getOrThrow(final ListenableFuture Future, final Duration timeout)
  4. getTTLSeconds(Duration duration)
  5. isDuration(String value)
  6. isInfPositive(Duration duration)
  7. max(Duration a, Duration b)
  8. min(Duration a, Duration b)
  9. minutesToDuration(long minutes)