Paul Peterson wrote:I don't like writing repetitive code for similar circumstances. One thing I have written and slightly modified several times is a method to save data to a file. I have part of my solution using lambdas, but how do I send a collection as a parameter without specifying what kind of collection it will be in the method signature?
Paul Peterson wrote:
I am getting an error message on lines 11 and 12 for the variable in the predicate and consumer saying "incompatible types: Object cannot be converted to CAP#1 where CAP#1 is a fresh type-variable CAP#1 extends Object from capture of ?"
Carey Brown wrote:Where are you using the "out" variable?
Junilu Lacar wrote:
Carey Brown wrote:Where are you using the "out" variable?
Good question. There's a call to flush() on line 15 but there's no way those lambdas are going to be able to access out to write anything to it.
There are three kinds of actuaries: those who can count, and those who can't.
Piet Souris wrote:
Well, it is possible, and we can repair the error that Paul reported with something like: (I replaced the cio calls, since I don't have this class)
Junilu Lacar wrote:Actually, have a cow for that, Piet.
Junilu Lacar wrote:
I think you can make that
There are three kinds of actuaries: those who can count, and those who can't.
Paul Peterson wrote:I am thrilled that you found a solution to my problem. I'm going to give that a try on the next project. I'm nearly done with this one and need to keep moving forward. At the moment I'm cleaning up some of my code so it will be available for recruiters and prospective employers. Definite time crunch to get as much done as quickly as possible. I really need to start working soon!
Junilu Lacar wrote:
There's a Go (the programming language) Proverb I really like and if anything, I'd hire and fire based on it: Clear is better than clever.
I think a lot of recruiters and employers these days would agree with that. Don't get too carried away with the lambdas; there's a point where it becomes less clear and more like you're just trying to be clever.
Don't MAKE me come back there with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|