Minborg

Minborg
Minborg

Sunday, December 25, 2016

Day 25, Java Holiday Calendar 2016, The Complete Deck

Day 25, Java Holiday Calendar 2016, The Complete Deck



Thank you all for following this year's Java Calendar. Here is the complete list with all the articles:



1: Use the @FunctionalInterface Annotation
If you want to ensure API users can use lambdas to implement your interface, it's important to make sure your code is annotated properly. Check out how to do it.

2: Favor Composition Over Inheritance
When you're working with your classes, make sure to use composition when you can for better separation of concerns, among a variety of other reasons. See how it's done.

3: Initializing Maps in the Smartest Way
Learn how you can create and initialize type-safe maps in Java by using two simple utility methods.

4: Use RemoveIf in Java Collections
If you want to remove elements from a collection quick, fast, and in a hurry, take a look at removeIf(), which should save you ton of time over manual iterations.

5: CRUD Operations
See how, with a handy open-source tool, you can alter your database entities, with standard CRUD operations, in Java.

6: Be Lazy With Java 8
If you want your code to kick in only when you need it, then lazy initialization is just right for you. See how you can get it working in Java 8.

7: Access Databases With Streams
Want to query your database with Java? See how Speedment and Java 8's streams can help you get to your data.

8: Use Traits in Java
Using traits can vastly help simplify your code and allow you to reuse components with ease. This example examines using traits with interfaces.

9:Event Sourcing
Event sourcing opens up a new way of looking at your database apps. Turn your database into a record of transactions that you can look back to and restart from.

10: MapStream
The open-source class MapStream lets you stream over elements as well as pairs of key value elements, making changes to everything along the way.

11: Try Java FX
JavaFX offers a variety of features that help improve observability, configure various bindings, and combine with reactive libraries.

12: Avoid Overloading With Lambdas
Lambdas are fantastic, but their popularity might lead to sloppy use. Naming them after specific uses keeps both the compiler and the client happy.

13: Try Higher Order of Functionality
See a QuickSort algorithm in action as an example of Higher Order Functionality. Taking declarative programming to a new level opens new doors to abstraction.

14: Submitting a Task
These days, Java developers have a variety of means to execute tasks. From threads to join pools to caching, you have no shortage of options.

15: Don’t Optimize Now!
If you're going to use JVM, it's important to know what's going on under the hood. Knowing exactly how code flattening works can save you time to put to better use.

16: Hacking the Existing Java Classes
Get your black hat - it's time to hack some classes. But because everyone follows the rules, this tip will help squash third-party bugs and deal with non-standard classes.

17: Parallel Streams in Custom Thread Pools
Java 8's streams, in theory, make it easy to use parallelism. It doesn't always turn out that way, but you can create custom thread pools to expand your resources.

18: Easily Create Database Content
You can use Java and Speedment together to easily analyze your database and generate code and content for it as well.

19: Speed Up Your Enums
The .values() method might seem speedy, but it actually creates a copy of your array, adding to your overhead. Doing a bit of extra work yourself will help in the long run.

20: Break Out of the Java Heap
Moving data off the heap, within reason, can let you work more efficiently while keeping latency low. That way, you can avoid the garbage collection wall for longer.

21: Concatenate Java Streams
Merging your streams through concatenation can allow one stream to lazily consume others, saving you time and making your code more efficient.

22: Use Enums as Method Parameters
Using Enums as parameters can greatly enhance the versatility of your methods. This example shows off how Enums can be used to nimbly and simply sort your lists.

23: Use Mappable Types Instead of Bloated Ones
Using mappable types in your geometric classes means less inter-class coupling and opens up a more functional path -- where you can apply functions on objects.

24: How Many Santas Are There, Really?
Yes, Virginia, there really is a Santa Claus. In fact, there might be a lot of them. Let's do some Java math to see how many Santas it takes to deliver presents around the world.


Follow the Java Holiday Calendar 2016 with small tips and tricks all the way through the winter holiday season. I am contributing to open-source Speedment, a stream based ORM tool and runtime. Please check it out on GitHub.

No comments:

Post a Comment