Guiding Principles
Consider adding a gatherer if it cannot be implemented with
map
,filter
, or a collector without enclosing outside state.Resist the temptation to add functions that only exist to provide an alias. They seem fun/handy but add surface area to the API and must be maintained forever.
All features should be documented and tested.
Follow the naming convention, unless it makes things unclear.
Naming Convention
Use imperative tense when possible (prefer
group()
overgrouping()
orgrouped()
)...By()
- Perform the action on the output of the given function (usually aFunction
orComparator
)ensure...()
- Make sure something about the stream is true and fail if it isn’t...Indexed()
- Perform the action, including the zero-based index of the element in the stream