Example usage for java.time Duration getUnits

List of usage examples for java.time Duration getUnits

Introduction

In this page you can find the example usage for java.time Duration getUnits.

Prototype

@Override
public List<TemporalUnit> getUnits() 

Source Link

Document

Gets the set of units supported by this duration.

Usage

From source file:Main.java

public static void main(String[] args) {
    Duration duration = Duration.between(LocalTime.MIDNIGHT, LocalTime.NOON);
    List<TemporalUnit> l = duration.getUnits();
    for (TemporalUnit u : l) {
        System.out.println(u);//from  ww w .jav  a 2  s .c  o m
    }
}