amaembo / streamex

Enhancing Java Stream API
Apache License 2.0
2.18k stars 249 forks source link

Add IntStreamEx.toSet() #241

Closed numeralnathan closed 3 years ago

numeralnathan commented 3 years ago

IntStreamEx already has toBitSet(). This only works if the integers are non-negative and not too large. I have a stream of integers that can range from -1 to 31. Please add Set toSet() method to handle this case.

amaembo commented 3 years ago

Hello! You can easily do .boxed().toSet(). I don't want to add a shortcut here, because it should be explicit that numbers will be boxed in this case.