runeflobakk / motif

A Java library helping you to compose behavior from smaller parts.
http://runeflobakk.github.io/motif
6 stars 0 forks source link

Iterating after .map does two calls on the mapping Fn per element #20

Closed runeflobakk closed 10 years ago

runeflobakk commented 10 years ago

Works as long as the mapping Fn is referentially transparent, but if it has side effects (e.g. printing to console or other IO) this will be performed twice.

Consider fasttrack-releasing fix for this as version 0.4.1.

runeflobakk commented 10 years ago

Seems to be the case for both Optional and PreparedIterable. Create some thorough unit tests to prevent this kind of unwanted invocations.

runeflobakk commented 10 years ago

False alarm... was fooled by the Eclipse debugger.