RTFJD (the JavaDocs are your friends!) If you haven't read them in a long time, then RRTFJD (they might have changed!)
Here Kousen is using a Function<Object, String> to demonstrate the super keyword and exploit the fact that an Employee IS‑AN Object.. . . the input variable could have been treated as a method from Object rather than Employee, because of the super wildcard. The output type could, in principle, have been a List containing subclasses of String , but String is final so there aren’t any.
Generic type arguments are inferred from assignment context as well as from functional interface implementations.
RTFJD (the JavaDocs are your friends!) If you haven't read them in a long time, then RRTFJD (they might have changed!)
RTFJD (the JavaDocs are your friends!) If you haven't read them in a long time, then RRTFJD (they might have changed!)
That's a pleasureJesse Silverman wrote:. . . Thanks . . .
Campbell Ritchie wrote:The method adds an R type parameter, and I think (not certain) R is short for result. It produced a Stream<R> as its result. The R can usually be inferred from the type of the Function. As we know, Function takes two types, T which is the type of the argument to its functional method and R which is that method's return type. That method consumes its argument, which is why it is defined as, “unknown extends T,” and produces its returns value, so that is declared as, “unknown super R,”.
RTFJD (the JavaDocs are your friends!) If you haven't read them in a long time, then RRTFJD (they might have changed!)
Yes, it does; well done finding my daft mistake And sorry.Jesse Silverman wrote:. . . a "Strike That, Reverse That!" typo??
RTFJD (the JavaDocs are your friends!) If you haven't read them in a long time, then RRTFJD (they might have changed!)
RTFJD (the JavaDocs are your friends!) If you haven't read them in a long time, then RRTFJD (they might have changed!)
Many objects or λs act as consumer and producer simultaneously. In the Object::toString example I showed you from Ken Kousen's book, the parameters to the method “consume” the input and the method “produces” a return value. That means that Producers might produce things and Consumers might consume things, but a Function does both.Jesse Silverman wrote:. . . Consumer, it consumes whatever you give it and gives nothing back, like the worst dog in the world. . . .
Stephan van Hulst wrote:I can't make comments on Scala because I haven't really worked with it.
I'm not excited about learning languages that improve on a parent language without introducing some radical new concepts. Scala seems decent enough, but I won't be spending my free time on it until I need it for my professional life.
Stephan van Hulst wrote:
Kotlin is worse. In my (admittedly limited) experience, it's just a poorly documented clone of Java that doesn't really commit to OO and also doesn't really commit to functional programming, but is a half-hearted mix of both, with some terrible new features bolted on top.
Stephan van Hulst wrote:
Currently my favorite language is C#. It took Java, and REALLY improved on it. The only reason I don't use it more in hobby projects is because Microsoft is still bad at writing tools and documentation, and every time I try to invest time in learning the nasty details of MSBuild and NuGet, I just end up frustrated because Maven is SO much better.
Stephan van Hulst wrote:I think the top candidate for my next language to learn is Rust. It seems to offer some exciting features that I haven't encountered in other languages yet.
RTFJD (the JavaDocs are your friends!) If you haven't read them in a long time, then RRTFJD (they might have changed!)
Jesse Silverman wrote:
Stephan van Hulst wrote:
Currently my favorite language is C#. It took Java, and REALLY improved on it. The only reason I don't use it more in hobby projects is because Microsoft is still bad at writing tools and documentation, and every time I try to invest time in learning the nasty details of MSBuild and NuGet, I just end up frustrated because Maven is SO much better.
Yeah, but an ever-increasing percentage of their docs are open-sourced, I think I have almost a dozen docs corrections for C#/.Net/PowerShell, versus 0 for Javadocs which I actually use more. A few Javadocs errors I have noticed have remained open with "Yeah, that's bad, someone should fix this" up to 15+ years!! Some of my rendering complaints are waiting for new docs-processing toolchains to go into production, but the others have all been addressed. Python docs are also easier to contribute to, tho I have gotten some "Yeah, we aren't going to bother to do that" for fixes they considered too trivial.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Rob Spoor wrote:...
OpenJDK is open source, and it's on GitHub these days: https://github.com/openjdk/jdk/. However, the process is still sluggish. Before Oracle even considers a pull request, you have to go through this entire slow procedure. I just don't think it's worth it anymore. I have a local branch that adds the getChars method from String / StringBuilder to CharSequence so that instanceof checks like this one will no longer be necessary. That code is probably never going to make its way into the JDK because of the cumbersome procedure involved.
RTFJD (the JavaDocs are your friends!) If you haven't read them in a long time, then RRTFJD (they might have changed!)
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Stephan van Hulst wrote:...
Currently my favorite language is C#. It took Java, and REALLY improved on it. The only reason I don't use it more in hobby projects is because Microsoft is still bad at writing tools and documentation, and every time I try to invest time in learning the nasty details of MSBuild and NuGet, I just end up frustrated because Maven is SO much better.
RTFJD (the JavaDocs are your friends!) If you haven't read them in a long time, then RRTFJD (they might have changed!)
An elephant? An actual elephant. Into the apartment. How is the floor still here. Hold this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|