public DayOfTheWeek next ( ) { if ( this == PH ) { return null ; } final int nextId = id + 1 ; if ( nextId == PH . id ) { return MON ; } for ( final DayOfTheWeek dow : ALL ) { if ( dow . id == nextId ) { return dow ; } } throw new IllegalStateException ( "Wasn't able to find next day for: " + this ) ; }
Returns the next day .