Viktor Logwin wrote:I have to say, the third chapter of the book was like hell for me. I was staring at this method references and didn't knew, what to do with it.
But in this chapter you only need to memorize, that there are alternatives to the lambda expressions. So you can write a lambda expression instead of a method reference. But the other way not always work. In the chapter 4 you will learn more built-in functional interfaces.
In my opinion, the method references sub-chapter shouldn't be there in the third chapter. It belongs to chapter 4. It makes much confusion.
Viktor Logwin wrote:Sorry, the second idea is what you need.
..Let's look at some examples from the Java API. In each set, we show the lambda equivalent.
Next up is calling an instance method on a specific instance:
Line 17 shows that we want to call string.startsWith() and pass a single parameter to be supplied at runtime. This would be a nice way of filtering the data in a list.
Liutauras Vilda wrote:John, just to re-iterate, what code formatting style you see on EnthuWare mock questions, this is what you should expect on actual exam basically. So I think you just need to get used to it. Give yourself some time.
Paul Anilprem wrote:
Can you please mention the question id of such a question (any one is fine) so that I can check it out? Because unless the point of the question is to test you on the format, the code should be decently (if not perfectly) formatted. Not to say that all the code in the exam is decently formatted, but we haven't seen anyone getting code that is all on one line or such. Our question bank doesn't have such questions either. If you saw something like that then there could be some other issue.