dpaukov / combinatoricslib

Combinatorial Objects Generators for Java 7+.
GNU Lesser General Public License v3.0
88 stars 15 forks source link

Use the Visistor pattern for ComplexCombinationIterator to avoid unnecessary creation of objects #15

Open axkr opened 9 years ago

axkr commented 9 years ago

Suppose you would like to analyze the combinations only until you have found a "match" and then stop the iteration. Wouldn't it be better to use the Visitor pattern for each generated combination to avoid the creation of all combinations in ComplexCombinationIterator#init() method for the iterator in the _resultSet variable? See: https://en.wikipedia.org/wiki/Visitor_pattern