Readability strongly depends on case, sometimes it is better, sometimes
worse.
Additionaly it is also a matter of personal preference.
Paralelization is easy, Just use
https://docs.oracle.com/javase/8/docs/api/java/util/stream/BaseStream.html#parallel--
But there is a trap. All invocations use the
My understanding is the Stream/lambda usage provides a "functional" way of
doing things, (some say) better readability, and provides opportunities for
parallel processing (i.e. the internal mechanisms leverage the
multi-core/process artifactures a little better if I understand correctly).
Eric Bre
Agreed.. but this is such a sexy hammer ;)
niedz., 29 sty 2023, 15:56 użytkownik Laszlo Kishalmi <
laszlo.kisha...@gmail.com> napisał:
> As of readability and debug-ability, I'm sorry to say but old-school wins.
>
> It starting to look like when you found the hammer everything seems to
> be a na
As of readability and debug-ability, I'm sorry to say but old-school wins.
It starting to look like when you found the hammer everything seems to
be a nail...
On 1/29/23 02:21, Łukasz Bownik wrote:
I can't help it
It's stronger than me!
AARGH!
;););););)
toURLs(Stream
I can't help it
It's stronger than me!
AARGH!
;););););)
toURLs(Stream.of(prjs).
flatMap(this::toArtifacts).
flatMap(this::toLocations).
collect(toList());
}
private Stream toArtifacts(Project prj) {
return Stream.o
And what about old school
List uris = new ArrayList<>(prjs.length);
for (Project p : prjs) {
for (AntArtifact a :
AntArtifactQuery.findArtifactsByType(p,
JavaProjectConstants.ARTIFACT_TYPE_JAR)) {
uris.addAll(Arrays.asList(a.getArtifactLocations()));
Hi,
So what is the value added if you submit this change? Is this a ten
element list or a ten hundred thousand element list? Is this running
inside a loop? What are the pros and cons of this change? Is this going
to win ten manoseconds or ten minutes in running time?
Thanks,
Antonio
On 29/1
How about "Stream.of"? it reads more like English :)
niedz., 29 sty 2023, 06:59 użytkownik name name2
napisał:
> toURLs(
> Arrays.asList(prjs).stream().flatMap(
> (prj) -> Arrays.asList(
> AntArtifactQuery.findArtifactsByType(prj,
> JavaProjectConstants.ARTIFACT_TYPE_JAR)
> )