scala - Zipper vs. iterator for walking over a list or tree -
suppose need walk on list or tree read (but not modify) data. can use either iterator or zipper. zipper
have advantages aside immutability in case?
do need backtrack or otherwise move around in structure in non-sequential order? want able traverse structure multiple times without worrying left iteration? want avoid thinking concurrent access or thread safety? go zipper.
do know fact need performance iterator can provide in situations? working on team doesn't want learn new abstraction? go iterator.
Comments
Post a Comment