You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by "bodewig (via GitHub)" <gi...@apache.org> on 2025/08/02 16:12:02 UTC
Re: [PR] Use StreamSupport and spliterator to create a stream for ResourceCollection [ant]
bodewig commented on PR #223:
URL: https://github.com/apache/ant/pull/223#issuecomment-3146588601
Thank you.
At first glance I don't believe there's been a reason to not use StreamSupport when the [big commit](https://github.com/apache/ant/commit/b7d1e9bde44cb8e5233d6e70bb96e14cbb2f3e2d) that moved us to Java 8 features was created.
But then I was wondering whether we should override `spliterator` since we know `size()` and could do better than use the default. Which reminded me that some implementations don't know their size without iteration (filtered collections of any kind), Those collections use an internal cache to avoid repeated iterations (`MappedResourceCollection` for example). The default `spliterator` uses `iterator` if I understand correctly, so using StreamSupport the way you do should also be using the cache.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org