Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Java Holiday Calendar 2016 (Day 25): The Complete Deck

DZone's Guide to

Java Holiday Calendar 2016 (Day 25): The Complete Deck

This is the end of the 2016 Java Holiday Calendar! Look back on everything you've learned this month and get ready for a new year of new challenges.

· Java Zone
Free Resource

Learn how to troubleshoot and diagnose some of the most common performance issues in Java today. Brought to you in partnership with AppDynamics.

Image title


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

Image title


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 possible 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 a 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.

Understand the needs and benefits around implementing the right monitoring solution for a growing containerized market. Brought to you in partnership with AppDynamics.

Topics:
java ,lambda function ,composition ,java performance

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}