• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Why doesn't reduce() throw a Runtime exception on an empty stream instead of returning the identity?

 
Ranch Foreman
Posts: 626
2
  • Number of slices to send:
    Optional 'thank-you' note:
a) Stream.reduce()

returns identity on an empty stream.
So for instance, this is an incorrect result returned.



Output:

1



I understand that

b)

Output:

Optional.empty


will return an empty Optional - which is the correct result.
However, if a) could throw a Runtime exception, then we would not have the risk of a silent error.
An insidious bug.
In a more elaborate reduce operation, it might not be so easy to spot that there was either an empty stream, or worse,
that the stream had elements but the identity was not the correct result.

The docs say

This means that for all t, accumulator.apply(identity, t) is equal to t.



I am wondering if there are other circumstances where the identity returned in the reduce in a) is incorrect?

 
 
Marshal
Posts: 28258
95
  • Number of slices to send:
    Optional 'thank-you' note:
I don't see why returning the identity value of the operator is incorrect. Maybe you could explain this?
 
Anil Philip
Ranch Foreman
Posts: 626
2
  • Number of slices to send:
    Optional 'thank-you' note:

Paul Clapham wrote:I don't see why returning the identity value of the operator is incorrect. Maybe you could explain this?



nothing times nothing is not equal to 1

unless I am missing something.
 
Master Rancher
Posts: 4905
74
  • 1
  • Number of slices to send:
    Optional 'thank-you' note:

Anil Philip wrote:

Paul Clapham wrote:I don't see why returning the identity value of the operator is incorrect. Maybe you could explain this?



nothing times nothing is not equal to 1

unless I am missing something.



First, you aren't starting with nothing - you are starting with 1.  As your code specifies when you write stream.reduce(1, Math::multiplyExact)).  

Second, you aren't multiplying by nothing.  You are multiplying by a value in the stream, for each element in the stream.  If there are no values in the stream, then no multiplication occurs at all.  There's nothing to multiply.  So, you're just left with what you started with.  Which was 1.

Here's some code to look at that may help you feel better about it:

Output:
 
Paul Clapham
Marshal
Posts: 28258
95
  • Number of slices to send:
    Optional 'thank-you' note:
The identity of an operator * is the value  e such that e * x = x for every value x in the domain of that operator. That's how it's defined.

So 1 is the identity of multiplication and 0 is the identity of addition. (This means that the sum of an empty set of integers is 0 and the product of an empty set of integers is 1.)

Not all operators have an identity -- you'll find that subtraction doesn't have one, for example. That's why the documentation mentions that operators must be associative if you're providing their identity. Also, providing an incorrect identity will produce weird results.

For an exercise, find out what the identity of Math.max is.
 
Anil Philip
Ranch Foreman
Posts: 626
2
  • Number of slices to send:
    Optional 'thank-you' note:
https://en.wikipedia.org/wiki/Identity_element

In mathematics, an identity element or neutral element of a binary operation is an element that leaves unchanged every element when the operation is applied.


a *1 = a
1 * 1 = 1
a + 0 = a

Paul Clapham wrote: (This means that the sum of an empty set of integers is 0 and the product of an empty set of integers is 1.)



Do you have a source for this?

 
Anil Philip
Ranch Foreman
Posts: 626
2
  • Number of slices to send:
    Optional 'thank-you' note:

Mike Simmons wrote: If there are no values in the stream, then no multiplication occurs at all.  There's nothing to multiply.  


Then there is no result. Please also see my reply to Paul above
 
Mike Simmons
Master Rancher
Posts: 4905
74
  • 1
  • Number of slices to send:
    Optional 'thank-you' note:
Just so you know, Paul C got his PhD in mathematics from Cal Tech. It might help to spend less time reflexively disagreeing, and more time absorbing. Also, your own source, wikipedia, is telling you in the article that you quoted, that the identity for the addition operation is 0, and that for multiplication is 1.  Maybe Paul is onto something here...

Anil Philip wrote:Then there is no result.


Well, you're using a method that documents pretty clearly how it works.  Have you looked at the API for Stream.reduce() with two arguments?  It says the result should be equivalent to:

In this code, if you have a stream with no elements, what is the result?
 
Marshal
Posts: 79392
377
  • Number of slices to send:
    Optional 'thank-you' note:
The whole idea of Streams was to provide code that would run normally to completion. Why would you want to throw an exception?
 
Anil Philip
Ranch Foreman
Posts: 626
2
  • Number of slices to send:
    Optional 'thank-you' note:

Campbell Ritchie wrote:The whole idea of Streams was to provide code that would run normally to completion. Why would you want to throw an exception?



At least it's better than providing an incorrect result.
If I see identity as the result, it is ambiguous in the current way.
There could have been zero to many elements in the stream, resulting in identity.
If an exception is thrown, at least we know that the operation never happened.
 
Anil Philip
Ranch Foreman
Posts: 626
2
  • Number of slices to send:
    Optional 'thank-you' note:

Mike Simmons wrote:Just so you know, Paul C got his PhD in mathematics from Cal Tech.


That is awesome... to have such great pedigree. Perhaps he can give us a good explanation?

Mike Simmons wrote:
It might help to spend less time reflexively disagreeing, and more time absorbing.


No, I am asking what I believe to be a valid question, to try and understand.

Mike Simmons wrote:
Also, your own source, wikipedia, is telling you in the article that you quoted, that the identity for the addition operation is 0, and that for multiplication is 1.  Maybe Paul is onto something here...


But I don't see where it says that when you have no elements to perform the operation on, Identity is still the result.

Mike Simmons wrote:
Well, you're using a method that documents pretty clearly how it works.  Have you looked at the API for Stream.reduce() with two arguments?  It says the result should be equivalent to:

In this code, if you have a stream with no elements, what is the result?



That is only telling me that Java is using the term 'identity' in a different way that Math uses it.
 
Mike Simmons
Master Rancher
Posts: 4905
74
  • Number of slices to send:
    Optional 'thank-you' note:

Anil Philip wrote:Perhaps he can give us a good explanation?


He did.  Whether he chooses to give another is up to him.

Anil Philip wrote:That is only telling me that Java is using the term 'identity' in a different way that Math uses it.


No, I don't think the problem is with identity at all - rather, it's with reduce.  The definition of identity doesn't say anything about what it's supposed to do with an arbitrary-length list or stream of elements - that's where the reduce operation comes into play.  We both seem to be happy enough with the Wikipedia article on identity, but we haven't agreed on what reduce should do.  I tried using Java's definition, which you had linked to previously, but you don't seem to like that now.  

In Wikipedia we have

Reduce_(higher-order_function)

which redirects to

Fold_(higher-order_function)

which reflects that outside Java, much of the Functional Programming community uses "fold" rather than "reduce".  The article is then somewhat dense with FP-specific terminology, so I'm not sure if you want to use that.  If not, what definition of reduce would you like to use?  What do you think it's supposed to mean?
 
Paul Clapham
Marshal
Posts: 28258
95
  • Number of slices to send:
    Optional 'thank-you' note:

Anil Philip wrote:That is awesome... to have such great pedigree. Perhaps he can give us a good explanation?


I already provided a good explanation.

Anil Philip wrote:But I don't see where it says that when you have no elements to perform the operation on, Identity is still the result.


Well, it doesn't specifically say that. It doesn't have to. When you take the product of a set of integers, you get an integer as the answer. And since the empty set is a set, the product of the empty set of integers has an integer value too. Mathematicians hate it when you make up special cases when there is no reason to do so, therefore you should treat the empty set the same way as a non-empty set if at all possible.

In Math you could write this theorem: If A and B are sets of integers then product(A) * product(B) = product(A followed by B). This is true whether or not A or B are empty so having to take into account something different when one or both sets is empty is just ugly because it's unnecessary. And mathematicians hate that sort of ugliness.

(Note: I wrote "followed by" instead of "union" so I avoided what would happen if an integer was in both A and B. If A is 1,4,6 and B is 2,4,12 then we're talking about 1,4,6,2,4,12.)

Anil Philip wrote:That is only telling me that Java is using the term 'identity' in a different way that Math uses it.


No, you have that backwards. You came here complaining that Java should throw an exception when asked to provide the product of an empty set of integers. But Java doesn't do that. It does what Math says it should do.
 
Anil Philip
Ranch Foreman
Posts: 626
2
  • 1
  • Number of slices to send:
    Optional 'thank-you' note:

Paul Clapham wrote:
I already provided a good explanation.

Anil Philip wrote:But I don't see where it says that when you have no elements to perform the operation on, Identity is still the result.


Well, it doesn't specifically say that. It doesn't have to. When you take the product of a set of integers, you get an integer as the answer. And since the empty set is a set, the product of the empty set of integers has an integer value too. ...
No, you have that backwards. You came here complaining that Java should throw an exception when asked to provide the product of an empty set of integers. But Java doesn't do that. It does what Math says it should do.



no point in continuing this discussion since you cannot provide me with any accepted source that backs up what you are saying.
(because I never heard this before in any Math class),
but instead say that I am "complaining" and "reflexively disagreeing".
 
Paul Clapham
Marshal
Posts: 28258
95
  • Number of slices to send:
    Optional 'thank-you' note:

Anil Philip wrote:no point in continuing this discussion since you cannot provide me with any accepted source that backs up what you are saying.
(because I never heard this before in any Math class),


Where "accepted" source means one that you personally accept? I do remember that my Math 1 students often found this view of empty sets to be disconcerting, but it's mainstream Math.

but instead say that I am "complaining" and "reflexively disagreeing".


You said "So for instance, this is an incorrect result returned" and called it "an insidious bug". Neither statement is true. This looks like complaints to me but maybe you're a person who doesn't consider seriously negative statements to be "complaints".
 
Campbell Ritchie
Marshal
Posts: 79392
377
  • Number of slices to send:
    Optional 'thank-you' note:

Anil Philip wrote:. . . At least it's better than providing an incorrect result. . . .

What makes you think 0 is a wrong result for a sum or 1 for a product?

There could have been zero to many elements in the stream, resulting in identity. . . .

Like this, you mean?What you are doing is reducing the Stream to a single value, which you can see clearly in IntStream#reduce(). When you reduce a Stream, you are losing information, including how many elements there were. That is normal behaviour for reducing; it does not care about any other information. The result would be the same for my IntStreams if you add more of the same elements. The limit to which the result tends as the Stream lengthens (with more of the same) is the same as the identity shown as the first argument in lines 2 and 4. If you shorten the Stream towards length 0, the limit towards which the result tends is also the identity (sometimes called the unit).
∴ The identity is the correct result from reducing a 0‑length Stream. The IntStream link I gave you says you must supply the appropriate identity.
It is like counting how much money you have in your pocket; you get a total and you forget whether it was in folding money or dollars or cents. You might be unlucky and not find any money at all. That is the identity or unit for addition: 0. When I go shopping, I pay the total price and don't worry about how many items I am paying for, assuming I am sure there has been no mistake in the counting.
And remember, after all the confusion I caused on your other thread, I showed you an example where a 0‑length Stream is a best practice option.
 * * * * * * * * * *
Note I have shown the behaviour defined by the two‑argument version of the method. Its name is overloaded and you might prefer to use the one‑argument version, which has a different return type and allows you to tell whether you started with a 0‑length Stream. The returned result isn't null, nor does the reduce() method throw an exception.
 
Saloon Keeper
Posts: 15608
366
  • Number of slices to send:
    Optional 'thank-you' note:
Man, I would be so upset if multiplying zero integers would return anything other than 1. Throwing an exception is what I would call "an insidious bug".

Anyway, seeing as you hold Wikipedia in high regard as an authoritative source, here's a link for you: https://en.m.wikipedia.org/wiki/Empty_product
 
Stephan van Hulst
Saloon Keeper
Posts: 15608
366
  • 2
  • Number of slices to send:
    Optional 'thank-you' note:
Just a word of advice. Your learning journey is going to be very tough if you insist on a source for everything we tell you. Stop and think about what you're doing:

You've joined a forum so that you can have your questions answered by experts who collectively have centuries of knowledge and experience; some, like Paul, directly at the very edge of human knowledge of a specific subject.

Now, instead of getting on with your life and trying to digest what we, a whole forum of experts, are telling you, you insist that we must be wrong because you, an intermediate, hasn't heard about it in school.

I'm not saying that scepticism isn't good, and I'm not saying that we are free from backing up our statements with good citations every now and then; but if EVERYONE else is agreeing with each other and is telling you that something works a certain way and that it is for a good reason, maybe just take the hint.
 
Campbell Ritchie
Marshal
Posts: 79392
377
  • Number of slices to send:
    Optional 'thank-you' note:

Stephan van Hulst wrote:. . . multiplying zero integers would return anything other than 1. . . .

If you multiply x by itselftimes, you will get xⁿ, so when you multiply it zero times, you should get x⁰, and for all finite values of x, that comes to 1, except in some cases if= 0.
 
Paul Clapham
Marshal
Posts: 28258
95
  • 1
  • Number of slices to send:
    Optional 'thank-you' note:

Stephan van Hulst wrote:here's a link for you: https://en.m.wikipedia.org/wiki/Empty_product



I noticed in that page a reference to "vacuous truth", which I remember from my Math 1 TA days because my students specifically asked me about the formulation given there: "empty set of objects can have any property". That's unfortunately misleading; for example it isn't true that an empty set has the property of containing seven elements. It's better to state it in terms of the elements of an empty set; statements about elements of any empty set are true. For example, "all of the crocodiles in my bathroom are blue" is a true statement because there are no crocodiles in my bathroom.
 
Campbell Ritchie
Marshal
Posts: 79392
377
  • Number of slices to send:
    Optional 'thank-you' note:

Paul Clapham wrote:. . . there are no crocodiles in my bathroom.

Are you sure about that?
Vacuously true things are true, but you can end up with a program like “Magic,” which can legitimately promise anything because it never has to deliver.
“Magic” is defined as false ⟶ skip where theis the guard operator. Its weakest precondition to establish any postcondition Q turns out to be vacuously true because the weakest precondition turns out to be false ⇒ skip[Q] and we all know that false ⇒ anything is true. Vacuously so.
 
Mike Simmons
Master Rancher
Posts: 4905
74
  • 1
  • Number of slices to send:
    Optional 'thank-you' note:

Campbell Ritchie wrote:

Paul Clapham wrote:. . . there are no crocodiles in my bathroom.

Are you sure about that?


I think Paul C is on pretty safe ground there.  If it was Tim H, someone might need to go check to be sure.  Though the answer might change with global warming...
 
Paul Clapham
Marshal
Posts: 28258
95
  • Number of slices to send:
    Optional 'thank-you' note:

Campbell Ritchie wrote:

Paul Clapham wrote:. . . there are no crocodiles in my bathroom.

Are you sure about that?


I suppose I should get used to having my assertions questioned here. No, unfortunately I can't point you to a reference on the web confirming that.
 
Enthuware Software Support
Posts: 4828
52
  • Number of slices to send:
    Optional 'thank-you' note:

Paul Clapham wrote:For example, "all of the crocodiles in my bathroom are blue" is a true statement because there are no crocodiles in my bathroom.


Genuine question: By the above logic, I could also say, "none of the crocodiles in my bathroom are blue", right?

 
Stephan van Hulst
Saloon Keeper
Posts: 15608
366
  • 1
  • Number of slices to send:
    Optional 'thank-you' note:
Let's convert that natural language statement to first-order logic:

¬∃𝑥∊𝓧 𝑃(𝑥)

Here, 𝓧 is the set of crocodiles in my bathroom, and 𝑃(𝑥) is the predicate that crocodile 𝑥 is blue.

The first-order logic statement above can be read as: "There does not exist at least one crocodile in my bathroom for which its color is blue".

The quantified function ∃𝑥∊𝓧 𝑃(𝑥) trivially returns false if 𝓧 is the empty set . So if we negate it with the ¬ operator, it returns true for the empty set.

As long as there are no crocodiles in our bathroom, both of the following statements hold true simultaneously:

"all of the crocodiles in my bathroom are blue"

"none of the crocodiles in my bathroom are blue"

 
Paul Anilprem
Enthuware Software Support
Posts: 4828
52
  • Number of slices to send:
    Optional 'thank-you' note:

Paul Clapham wrote:And since the empty set is a set, the product of the empty set of integers has an integer value too.



Stephan van Hulst wrote:Man, I would be so upset if multiplying zero integers would return anything other than 1. Throwing an exception is what I would call "an insidious bug".



I was watching a video on Russel's paradox on youtube (https://www.youtube.com/watch?v=ymGt7I4Yn3k&t=698s) and at around 11.50, while explaining empty sets, he says that there is exactly one empty set and that two empty sets are really the same set.

If he is right, an empty set is as much a set of Integers as it is a set of monkeys. So, it is not entirely implausible to think that multiplying the elements of an empty set of Integers should be undefined, in which case an RTE is more appropriate.

Not really questioning the logic behind the reduce(U identity,  BiFunction<U,? super T,U> accumulator, BinaryOperator< U> combiner) because returning identity for an empty set is also valid from one perspective, but since they already have so many methods, they could have easily had one that didn't take an identity parameter and threw an RTE for empty stream as well i.e., reduce( BiFunction<U,? super T,U> accumulator, BinaryOperator< U> combiner).

(Fixed formatting)
 
Campbell Ritchie
Marshal
Posts: 79392
377
  • 1
  • Number of slices to send:
    Optional 'thank-you' note:

Paul Anilprem wrote:. . . there is exactly one empty set and that two empty sets are really the same set. . . . an empty set is as much a set of Integers as it is a set of monkeys. . . .

That is the correct mathematical abstraction, but programmers have always bent the rules. For example, the double datatype supports the non‑existent number -0.0. Generics might allow a set containing no monkeys to be equal to a set containing no integers, but you can't interconvert the set by adding an integer to it. This reduce() method requires the user to supply an identity, 1 for multiplication or 0 for addition, but is there an identity appropriate for subtraction?
The reason for not throwing an exception is that the designers didn't want Streams to fail to complete their runs.
 
Paul Anilprem
Enthuware Software Support
Posts: 4828
52
  • Number of slices to send:
    Optional 'thank-you' note:

Campbell Ritchie wrote:
The reason for not throwing an exception is that the designers didn't want Streams to fail to complete their runs.


Right. I should rephrase it as:
"So, it is not entirely implausible to think that multiplying the elements of an empty set of Integers should be undefined, in which case an RTE is more appropriate returning an empty Optional is more appropriate. "

What I am trying to get at is that returning Identity makes the method more rigid than what is warranted. It doesn't allow the the programmer to have an alternate path if there are no elements in the stream.  Given that there already are a buttload of methods, what's one more? Unless it is doesn't make sense logically.
 
Campbell Ritchie
Marshal
Posts: 79392
377
  • Number of slices to send:
    Optional 'thank-you' note:

Paul Anilprem wrote:. . . returning an empty Optional is more appropriate.

Isn't that what happens if you use the method without the identity parameter?

. . . there already are a buttload of methods, what's one more?

Agree there

Unless it is doesn't make sense logically.

That never stopped them making StringBuilder implement Comparable even though it doesn't override equals().
 
Paul Anilprem
Enthuware Software Support
Posts: 4828
52
  • Number of slices to send:
    Optional 'thank-you' note:

Campbell Ritchie wrote:Isn't that what happens if you use the method without the identity parameter?


No, the one that doesn't take identity parameter takes one parameter of type BinaryOperator. A BinaryOperator restricts you to returning the same type as the type of the stream.
In fact, now I wonder why did they not design this method to accept a BiFunction like the other reduce method.
 
Paul Anilprem
Enthuware Software Support
Posts: 4828
52
  • 1
  • Number of slices to send:
    Optional 'thank-you' note:

Paul Anilprem wrote:

Campbell Ritchie wrote:Isn't that what happens if you use the method without the identity parameter?


No, the one that doesn't take identity parameter takes one parameter of type BinaryOperator. A BinaryOperator restricts you to returning the same type as the type of the stream.
In fact, now I wonder why did they not design this method to accept a BiFunction like the other reduce method.



Because that would require a combiner, of course!
 
Campbell Ritchie
Marshal
Posts: 79392
377
  • Number of slices to send:
    Optional 'thank-you' note:
I meant something slightly different, that the one‑argument version of that method returns OptionalInt.
If we are thinking of the IntStream method, the logic (I think) is that in an IntStream you are sticking to ints, and if you want a different datatype, you use a mapToXXX() method.
Another reason, maybe, for not throwing exceptions from an empty Stream is that exceptions are supposed to respond to something abnormal, and an empty Stream is regarded as a normal occurrence.
 
Paul Anilprem
Enthuware Software Support
Posts: 4828
52
  • Number of slices to send:
    Optional 'thank-you' note:

Campbell Ritchie wrote:
Another reason, maybe, for not throwing exceptions from an empty Stream is that exceptions are supposed to respond to something abnormal, and an empty Stream is regarded as a normal occurrence.


Yes, I agree with that. It seems reasonable.

What I am not sure about now is the reason behind having the following three methods in the Stream interface (i.e. the regular Stream interface and not the primitive stream interfaces such as IntStream) :
  • Optional<T> reduce(BinaryOperator<T> accumulator)
  • T reduce(T identity, BinaryOperator<T> accumulator)
  • V reduce(V identity, BiFunction< V,? super T,V> accumulator, BinaryOperator<V> combiner)


  • but not having:

    Optional<V> reduce(BiFunction<V,? super T, V> accumulator, BinaryOperator combiner)

     
    Mike Simmons
    Master Rancher
    Posts: 4905
    74
    • Number of slices to send:
      Optional 'thank-you' note:

    Paul Anilprem wrote:but not having:

    Optional<V> reduce(BiFunction<V,? super T, V> accumulator, BinaryOperator combiner)


    With this method, how would you ever get a V instance at all?  You have a stream of T, and you have a BiFunction to take a V and a T, and return a V.  Which means you need at least one V to use that function.  That's why you need an identity V instance, to start the reduction off.  

    And for parallel processing, each worker thread will use that same identity V instance to start off processing its own subset of elements, before combining later with the combiner.  And if any of those worker threads finds there are no elements for them to process (maybe it turns out that there's a filter() method that eliminates all the elements that might have been expected) you want the worker to not freak out and throw an exception, just return the identity value unmolested, so it can still be combined with the other results safely.
     
    Mike Simmons
    Master Rancher
    Posts: 4905
    74
    • Number of slices to send:
      Optional 'thank-you' note:

    Campbell Ritchie wrote:This reduce() method requires the user to supply an identity, 1 for multiplication or 0 for addition, but is there an identity appropriate for subtraction?


    No.  Subtraction is not a suitable reduction operation in the first place, because it is not associative - i.e.

    (a-b)-c

    is not the same as

    a-(b-c)

    Associativity is one of the properties required of the accumulator, in order to get a meaningful result.
     
    Campbell Ritchie
    Marshal
    Posts: 79392
    377
    • Number of slices to send:
      Optional 'thank-you' note:

    Mike Simmons wrote:. . . No. . . . .

    I thought not; I would have been sure if I had bothered to read the documentation.
     
    Mike Simmons
    Master Rancher
    Posts: 4905
    74
    • Number of slices to send:
      Optional 'thank-you' note:
    Also covered by Dr. Clapham a few months ago, above:

    Paul Clapham wrote:Not all operators have an identity -- you'll find that subtraction doesn't have one, for example. That's why the documentation mentions that operators must be associative if you're providing their identity. Also, providing an incorrect identity will produce weird results.


     
    Mike Simmons
    Master Rancher
    Posts: 4905
    74
    • Number of slices to send:
      Optional 'thank-you' note:
    Although I don't really see a compelling use case for it, in theory I can buy the idea that some people might want to make a stream that fails if there are no elements in it.  As it happens, I was looking at Java 22's new Stream Gatherers feature, which purports to be a mechanism for adding arbitrary new functionality to streams as an intermediate method.  Much like Collectors can add arbitrary new features to Stream, except that Stream.collect(Collector) is a terminal operation, while Stream.gather(Gatherer) is an intermediate operation.  So, it's a good candidate for the use case here, which is to add fail-on-empty-stream functionality to a Stream without interfering with whatever other operations you wanted the Stream for.  Here's what I came up with:

    This requires Java 22, and further requires enabline preview features:

    But yes, it does work.  So, you may have to wait until September 2025 or so for a non-preview LTS implementation, but eventually, Java will allow this sort of arbitrary restriction to be inserted into a Stream.  Yay?  

    Well, I was mostly interested in getting a handle on Gatherers, and this is a fairly simple case for that.
     
    Don't get me started about those stupid light bulbs.
    reply
      Bookmark Topic Watch Topic
    • New Topic
    vceplus-200-125    | boson-200-125    | training-cissp    | actualtests-cissp    | techexams-cissp    | gratisexams-300-075    | pearsonitcertification-210-260    | examsboost-210-260    | examsforall-210-260    | dumps4free-210-260    | reddit-210-260    | cisexams-352-001    | itexamfox-352-001    | passguaranteed-352-001    | passeasily-352-001    | freeccnastudyguide-200-120    | gocertify-200-120    | passcerty-200-120    | certifyguide-70-980    | dumpscollection-70-980    | examcollection-70-534    | cbtnuggets-210-065    | examfiles-400-051    | passitdump-400-051    | pearsonitcertification-70-462    | anderseide-70-347    | thomas-70-533    | research-1V0-605    | topix-102-400    | certdepot-EX200    | pearsonit-640-916    | itproguru-70-533    | reddit-100-105    | channel9-70-346    | anderseide-70-346    | theiia-IIA-CIA-PART3    | certificationHP-hp0-s41    | pearsonitcertification-640-916    | anderMicrosoft-70-534    | cathMicrosoft-70-462    | examcollection-cca-500    | techexams-gcih    | mslearn-70-346    | measureup-70-486    | pass4sure-hp0-s41    | iiba-640-916    | itsecurity-sscp    | cbtnuggets-300-320    | blogged-70-486    | pass4sure-IIA-CIA-PART1    | cbtnuggets-100-101    | developerhandbook-70-486    | lpicisco-101    | mylearn-1V0-605    | tomsitpro-cism    | gnosis-101    | channel9Mic-70-534    | ipass-IIA-CIA-PART1    | forcerts-70-417    | tests-sy0-401    | ipasstheciaexam-IIA-CIA-PART3    | mostcisco-300-135    | buildazure-70-533    | cloudera-cca-500    | pdf4cert-2v0-621    | f5cisco-101    | gocertify-1z0-062    | quora-640-916    | micrcosoft-70-480    | brain2pass-70-417    | examcompass-sy0-401    | global-EX200    | iassc-ICGB    | vceplus-300-115    | quizlet-810-403    | cbtnuggets-70-697    | educationOracle-1Z0-434    | channel9-70-534    | officialcerts-400-051    | examsboost-IIA-CIA-PART1    | networktut-300-135    | teststarter-300-206    | pluralsight-70-486    | coding-70-486    | freeccna-100-101    | digitaltut-300-101    | iiba-CBAP    | virtuallymikebrown-640-916    | isaca-cism    | whizlabs-pmp    | techexams-70-980    | ciscopress-300-115    | techtarget-cism    | pearsonitcertification-300-070    | testking-2v0-621    | isacaNew-cism    | simplilearn-pmi-rmp    | simplilearn-pmp    | educationOracle-1z0-809    | education-1z0-809    | teachertube-1Z0-434    | villanovau-CBAP    | quora-300-206    | certifyguide-300-208    | cbtnuggets-100-105    | flydumps-70-417    | gratisexams-1V0-605    | ituonline-1z0-062    | techexams-cas-002    | simplilearn-70-534    | pluralsight-70-697    | theiia-IIA-CIA-PART1    | itexamtips-400-051    | pearsonitcertification-EX200    | pluralsight-70-480    | learn-hp0-s42    | giac-gpen    | mindhub-102-400    | coursesmsu-CBAP    | examsforall-2v0-621    | developerhandbook-70-487    | root-EX200    | coderanch-1z0-809    | getfreedumps-1z0-062    | comptia-cas-002    | quora-1z0-809    | boson-300-135    | killtest-2v0-621    | learncia-IIA-CIA-PART3    | computer-gcih    | universitycloudera-cca-500    | itexamrun-70-410    | certificationHPv2-hp0-s41    | certskills-100-105    | skipitnow-70-417    | gocertify-sy0-401    | prep4sure-70-417    | simplilearn-cisa    |
    http://www.pmsas.pr.gov.br/wp-content/    | http://www.pmsas.pr.gov.br/wp-content/    |