func (t *Totaler) Consume(s functional.Stream) { var entry Entry for s.Next(&entry) { if t.Income { if entry.Amount < 0 { t.Total -= entry.Amount } } else { if entry.Amount > 0 { t.Total += entry.Amount } } } }
func (p Printer) Consume(s functional.Stream) { var entry Entry for s.Next(&entry) { fmt.Println(&entry) } }