Java TimeUnit Calculate isValidTimeUnit(String timeUnit)

Here you can find the source of isValidTimeUnit(String timeUnit)

Description

is Valid Time Unit

License

Open Source License

Declaration

public static boolean isValidTimeUnit(String timeUnit) 

Method Source Code

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

import java.util.concurrent.TimeUnit;

public class Main {
    public static boolean isValidTimeUnit(String timeUnit) {
        for (TimeUnit type : TimeUnit.values()) {
            if (type.name().equalsIgnoreCase(timeUnit)) {
                return true;
            }//  w  ww.  j a v a2s. c  om
        }

        return false;
    }
}

Related

  1. getTimeUnit(String timeUnit, TimeUnit defaultUnit)
  2. getTimeUnitByName(String timeUnit, TimeUnit defaultTimeUnit)
  3. getValueString(long value, TimeUnit unit)
  4. getWindowFlooredBinaryTime(TimeUnit unit, long timestamp, int windowSizeInSeconds)
  5. humanReadableTime(long time, TimeUnit unit)
  6. logTiming(String description, int n, long time, TimeUnit unit)
  7. mapByName(TimeUnit... units)
  8. minus(Date date, int interval, TimeUnit unit)
  9. parseTimeUnit(final String unit)