@ Override public Iterator < Zone > iterateByName ( final String name ) { final Iterator < HostedZone > delegate = api . listHostedZonesByName ( name ) . iterator ( ) ; return new PeekingIterator < Zone > ( ) { @ Override protected Zone computeNext ( ) { if ( delegate . hasNext ( ) ) { HostedZone next = delegate . next ( ) ; if ( next . name . equals ( name ) ) { return zipWithSOA ( next ) ; } } return endOfData ( ) ; } } ; }
This implementation assumes that there isn t more than one page of zones with the same name .