From the course: Learning Lombok: Streamlined Java Programming
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Mutable local variables versus JEP 286 var - Spring Tutorial
From the course: Learning Lombok: Streamlined Java Programming
Mutable local variables versus JEP 286 var
- [Instructor] With IntelliJ open and the project code 20204 begin Lombok demo loaded, let's take a look at the employee image service. This was a new class added in chapter two for this tutorial to demonstrate JEP 286 and Project Lomboks var type. According to the documentation, var works exactly like val except the local variable is not marked as final. Lomboks var is basically a mutable version of val since JEP 286 and the release of var type in Java 10, var is a keyword and so we cannot use Lombok.var in our current project. According to the chief developers I chatted with about this feature, Lombok.var is kept primarily for legacy code written around Java 6, 7, 8, and 9. You might think that industry code bases in production would be upgraded by now, but the thing is there are various reasons at each software development shop why they're using a JDK prior to 10. As such, Loach maintains this backward compatibility for…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Lombok implements a builder design pattern4m 55s
-
(Locked)
Simplifying null checks and removing bloat3m 58s
-
(Locked)
Simplify final local variable declaration4m 40s
-
(Locked)
Mutable local variables versus JEP 286 var4m 22s
-
(Locked)
Mutable setters using Lombok @With4m 17s
-
(Locked)
Challenge: Utilizing simplified Lombok POJOs3m 41s
-
(Locked)
Solution: Utilizing simplified Lombok POJOs8m 19s
-
-
-