JavaRush /Java Blog /Random EN /Spring is not scary, or brevity is the sister of talent
Павел
Level 11

Spring is not scary, or brevity is the sister of talent

Published in the Random EN group
CONTENT OF THE ARTICLE CYCLE The title of the article reflects two things at once: The first is my desire to set a record for writing the shortest article in the history of CodeGym; The second is today's topic: highlight lambda expressions and StreamAPI - they make the code much shorter. Straight to the point: we will be using lambda and StreamAPI later in our project. Put validol in place! If you have never met either lambda or StreamAPI, do not despair, you do not need to have a thorough knowledge, but you should be familiar (this is really important). Moreover, a bunch of good literature has already been written on these topics: Start your acquaintance with the unforgettable Herbert Schildt "Java 8. A Beginner's Guide". He has a small, 30 page, but capacious chapter: "Lambda expressions and method references", the book itself is very easy to find on the Internet. After Shield, read about StreamAPI:Complete Guide to Java 8 Stream API with Pictures and Examples . There is not much theory there, only the most necessary, the main thing is to remember the three types of operators and what is the difference between them. But there are quite a few examples there, with pictures, and with animation, and with an explanation. Implement a couple of examples for yourself. For those used to the style of CodeGym articles: - Popular about lambda expressions in Java. With examples and tasks. Part 1 - Popular about lambda expressions in Java. With examples and tasks. Part 2 - Lambda Expressions with Examples Streams are constantly used in development, you can't do without them. This is especially useful when you need to "map" something. Here the most grouchy reader mutters: "Here again, they throw their jargon, and I'm a simple accountant and how do I know what this mapping of yours is." Wikipedia says: "Mapping, mapping (English mapping): Mapping (data mapping) - in programming, determining the correspondence of data between sequences of elements." If we draw an analogy, then mapping is similar to conversion: we take a photo of a cat in png format and convert it to jpg in an online converter. What has changed? The cat in the photo (data) remained the same, but the photo (object) itself became completely different. This is what we will do in the project: convert one object to another. Will be cool! I would like to add a quote from the article, which I read not long ago: “Is your goal to get a green tick or a gold star? Leave this pass/fail bullshit for elementary school where it belongs. Instead, your goal should be to gain knowledge. How are they purchased? Through failure and adaptation. Again and again. To do this, you need to get acquainted with many different tasks. And quickly.” Shield is waiting for you. To be continued…
Comments
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION