I think this class is on its way howver I agree with Sebb's comments there has to be more flexibility about the rounding approach.
I am not sure a Utils class is the way to handle this flexibility. What about a DurationRounder class or similar. Then an Enum for rounding method: RoundingMethod.ROUND_UP, RoundingMethod .ROUND_DOWN etc. You will want to include what is known in Matlab as the fix() or "round toward zero" method, which is a common method when there are positive and negative numbers. The user can then set the rounding method of the object during construction (or a setter I guess). Then when the object is passed a Duration the state of the object will dictate how it rounds. In Python or Matlab the enum would reference a function handle, I am not sure what would be the most elegant Java solution for such a situation -- perhaps using MethodHandle, or using a lambda expression? And then I would say ditto for the unit of rounding. So rather than repetitive methods like roundUpDays(), you construct a DurationRounder(RoundingMethod.FIX, RoundingUnit.SECONDS) and then just call round() . Please jump in if anyone finds this approach objectionable. Eric On Tue, Mar 12, 2019 at 4:05 PM Aleksander Ściborek < aleksanderscibo...@gmail.com> wrote: > Hi, > I would like to remind abut my pull request : > https://github.com/apache/commons-lang/pull/406 > I know that you have a lot of work, but please take look at it - this PR > was created almost month ago. > Aleksander >