public ZoneRules toRules(String zoneId){
  Objects.requireNonNull(zoneId,"zoneId");
  if (windowList.isEmpty()) {
    throw new IllegalStateException("No windows have been added to the builder");
  }
  final List<ZoneOffsetTransition> standardTransitionList=new ArrayList<>(4);
  final List<ZoneOffsetTransition> transitionList=new ArrayList<>(256);
  final List<ZoneOffsetTransitionRule> lastTransitionRuleList=new ArrayList<>(2);
  final TZWindow firstWindow=windowList.get(0);
  ZoneOffset loopStandardOffset=firstWindow.standardOffset;
  int loopSavings=0;
  if (firstWindow.fixedSavingAmountSecs != null) {
    loopSavings=firstWindow.fixedSavingAmountSecs;
  }
  final ZoneOffset firstWallOffset=ZoneOffset.ofTotalSeconds(loopStandardOffset.getTotalSeconds() + loopSavings);
  LocalDateTime loopWindowStart=LocalDateTime.of(YEAR_MIN_VALUE,1,1,0,0);
  ZoneOffset loopWindowOffset=firstWallOffset;
  for (  TZWindow window : windowList) {
    window.tidy(loopWindowStart.getYear());
    Integer effectiveSavings=window.fixedSavingAmountSecs;
    if (effectiveSavings == null) {
      effectiveSavings=0;
      for (      TZRule rule : window.ruleList) {
        if (rule.toEpochSecond(loopStandardOffset,loopSavings) > loopWindowStart.toEpochSecond(loopWindowOffset)) {
          break;
        }
        effectiveSavings=rule.savingAmountSecs;
      }
    }
    if (loopStandardOffset.equals(window.standardOffset) == false) {
      standardTransitionList.add(new ZoneOffsetTransition(LocalDateTime.ofEpochSecond(loopWindowStart.toEpochSecond(loopWindowOffset),0,loopStandardOffset),loopStandardOffset,window.standardOffset));
      loopStandardOffset=window.standardOffset;
    }
    ZoneOffset effectiveWallOffset=ZoneOffset.ofTotalSeconds(loopStandardOffset.getTotalSeconds() + effectiveSavings);
    if (loopWindowOffset.equals(effectiveWallOffset) == false) {
      transitionList.add(new ZoneOffsetTransition(loopWindowStart,loopWindowOffset,effectiveWallOffset));
    }
    loopSavings=effectiveSavings;
    for (    TZRule rule : window.ruleList) {
      if (rule.isTransition(loopSavings)) {
        ZoneOffsetTransition trans=rule.toTransition(loopStandardOffset,loopSavings);
        if (trans.toEpochSecond() < loopWindowStart.toEpochSecond(loopWindowOffset) == false && trans.toEpochSecond() < window.createDateTimeEpochSecond(loopSavings)) {
          transitionList.add(trans);
          loopSavings=rule.savingAmountSecs;
        }
      }
    }
    for (    TZRule lastRule : window.lastRuleList) {
      lastTransitionRuleList.add(lastRule.toTransitionRule(loopStandardOffset,loopSavings));
      loopSavings=lastRule.savingAmountSecs;
    }
    loopWindowOffset=window.createWallOffset(loopSavings);
    loopWindowStart=LocalDateTime.ofEpochSecond(window.createDateTimeEpochSecond(loopSavings),0,loopWindowOffset);
  }
  return new ZoneRules(firstWindow.standardOffset,firstWallOffset,standardTransitionList,transitionList,lastTransitionRuleList);
}

public ZoneRules toRules ( String zoneId ) { Objects . requireNonNull ( zoneId , "zoneId" ) ; if ( windowList . isEmpty ( ) ) { throw new IllegalStateException ( "No windows have been added to the builder" ) ; } final List < ZoneOffsetTransition > standardTransitionList = new ArrayList < > ( 4 ) ; final List < ZoneOffsetTransition > transitionList = new ArrayList < > ( 256 ) ; final List < ZoneOffsetTransitionRule > lastTransitionRuleList = new ArrayList < > ( 2 ) ; final TZWindow firstWindow = windowList . get ( 0 ) ; ZoneOffset loopStandardOffset = firstWindow . standardOffset ; int loopSavings = 0 ; if ( firstWindow . fixedSavingAmountSecs != null ) { loopSavings = firstWindow . fixedSavingAmountSecs ; } final ZoneOffset firstWallOffset = ZoneOffset . ofTotalSeconds ( loopStandardOffset . getTotalSeconds ( ) + loopSavings ) ; LocalDateTime loopWindowStart = LocalDateTime . of ( YEAR_MIN_VALUE , 1 , 1 , 0 , 0 ) ; ZoneOffset loopWindowOffset = firstWallOffset ; for ( TZWindow window : windowList ) { window . tidy ( loopWindowStart . getYear ( ) ) ; Integer effectiveSavings = window . fixedSavingAmountSecs ; if ( effectiveSavings == null ) { effectiveSavings = 0 ; for ( TZRule rule : window . ruleList ) { if ( rule . toEpochSecond ( loopStandardOffset , loopSavings ) > loopWindowStart . toEpochSecond ( loopWindowOffset ) ) { break ; } effectiveSavings = rule . savingAmountSecs ; } } if ( loopStandardOffset . equals ( window . standardOffset ) == false ) { standardTransitionList . add ( new ZoneOffsetTransition ( LocalDateTime . ofEpochSecond ( loopWindowStart . toEpochSecond ( loopWindowOffset ) , 0 , loopStandardOffset ) , loopStandardOffset , window . standardOffset ) ) ; loopStandardOffset = window . standardOffset ; } ZoneOffset effectiveWallOffset = ZoneOffset . ofTotalSeconds ( loopStandardOffset . getTotalSeconds ( ) + effectiveSavings ) ; if ( loopWindowOffset . equals ( effectiveWallOffset ) == false ) { transitionList . add ( new ZoneOffsetTransition ( loopWindowStart , loopWindowOffset , effectiveWallOffset ) ) ; } loopSavings = effectiveSavings ; for ( TZRule rule : window . ruleList ) { if ( rule . isTransition ( loopSavings ) ) { ZoneOffsetTransition trans = rule . toTransition ( loopStandardOffset , loopSavings ) ; if ( trans . toEpochSecond ( ) < loopWindowStart . toEpochSecond ( loopWindowOffset ) == false && trans . toEpochSecond ( ) < window . createDateTimeEpochSecond ( loopSavings ) ) { transitionList . add ( trans ) ; loopSavings = rule . savingAmountSecs ; } } } for ( TZRule lastRule : window . lastRuleList ) { lastTransitionRuleList . add ( lastRule . toTransitionRule ( loopStandardOffset , loopSavings ) ) ; loopSavings = lastRule . savingAmountSecs ; } loopWindowOffset = window . createWallOffset ( loopSavings ) ; loopWindowStart = LocalDateTime . ofEpochSecond ( window . createDateTimeEpochSecond ( loopSavings ) , 0 , loopWindowOffset ) ; } return new ZoneRules ( firstWindow . standardOffset , firstWallOffset , standardTransitionList , transitionList , lastTransitionRuleList ) ; }
completes the build converting the builder to a set of time - zone rules . < p > calling this method alters the state of the builder . further rules should not be added to this builder once this method is called .
