Subscribe: Javalobby - The heart of the Java developer community
Added By: Feedage Forager Feedage Grade A rated
Language: English
code  developers  evaluation  exception  idea  intellij idea  java  lazy evaluation  methods  new  null  objects  problem  release 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Javalobby - The heart of the Java developer community

DZone Java Zone

Recent posts in Java on


Configuring HTTPS for Use With Servlets [Snippet]

Mon, 19 Feb 2018 21:01:01 GMT

Configuring your Java EE application to communicate over HTTPS requires a few lines of XML in the web.xml file.

The web.xml file is located in the WEB-INF directory of your project and is usually created automatically when your IDE generates a Java EE web application. If it is not, you can create it yourself.

IntelliJ IDEA 2018.1 EAP: Inline External Annotations and Java Compiler Enhancements

Mon, 19 Feb 2018 17:01:05 GMT

A new IntelliJ IDEA 2018.1 EAP build is here now and it’s ready for your assessment! Download the latest build from our website, or update via the Toolbox App.

As you may already know, IntelliJ IDEA provides an ability to annotate your code via annotations.xml files, which are stored outside of your source code. These external annotations are especially useful when direct annotation of the source code is not possible (library classes). IntelliJ IDEA shows the icon in the gutter near the externally annotated code. With the upcoming IntelliJ IDEA 2018.1, this functionality has been extended, and now the IDE shows these external annotations inline in your code.

Getting Started With Java 9 Modules/Project Jigsaw [Video]

Mon, 19 Feb 2018 11:01:01 GMT

Much has been written about the much anticipated Project Jigsaw/Java 9 modules already.

But what if you want a simple, practical introduction of how to get started with your first self-made Java 9 modules?

Java 10 and the Emerging Problem of Release Fatigue

Mon, 19 Feb 2018 08:01:01 GMT

Last year, our most popular blog post by far was The Legacy Developer’s Guide to Java 9. With Java 10 around the corner, it was natural for us to consider writing up a “Legacy Developer’s Guide to Java 10.” However, in researching the topic, it became clear that Java 10 just isn’t that exciting, and that there’s really no reason for legacy developers to worry about how they can take advantage of it or even whether they need to think about it.

The problem with Java 10 reflects broader issues relating to software release cadences in Java and beyond. I would suggest that this is a consequence of the accelerated Java release cadence that Oracle announced last year. It used to be that new Java releases came out every couple of years – enough time to implement a checklist of significant new features. The release managers had to juggle a number of factors, including providing enough time to get enough features completed and into the release, and not taking so much time that people got frustrated waiting for the new release. Inevitably, some overly ambitious features would be postponed to a later release or discarded.

Hibernate/GORM: Solving the N+1 Problem

Mon, 19 Feb 2018 05:01:02 GMT

Many developers who work with Hibernate or any other ORM framework eventually run into the so-called N+1 problem.

Our team faced it when we were working on a project using Grails. For its ORM, Grails uses a GORM "under the hood" that contains the same old Hibernate. In case you haven't encountered this problem yet, let’s give you the gist of it. Let's say we have the following perfectly typical scheme: "News - Comment(s)".

CDI (Part 4): Lazy Initialization

Sun, 18 Feb 2018 06:01:03 GMT


This is the Part 4 of the CDI Series in Java that contains:

The Developer's Guide to Collections: Lists

Sat, 17 Feb 2018 05:01:02 GMT

Of all the collection types in Java, the list is arguably the most popular due to its ordered characteristics, allowing developers to insert and retrieve elements at a specified index and to sort elements according to specified criteria. In this article, we continue The Developer's Guide to Collections series with an examination of the list collection, focusing on the conceptual idea of a list in Java, the List interface and how its overridden methods differ from those of the Collection interface, supporting interfaces, and the concrete list types (and their respective advantages and disadvantages).

The reader should note that this article uses the common mathematical convention for indices, where is some arbitrary index, n is the size of the indexed entity, square brackets are used to denote inclusive ranges, and parentheses are used to denote exclusive ranges. Also note that while this article uses notation and illustrations that are normally associated with linked lists (such as previous and next relationships), not all lists are implemented as linked lists; some lists may internally use arrays while others are free to use whichever internal implementation is most suited for the task at hand. 

Spring MVC Exception Handling and Monitoring With Rollbar

Fri, 16 Feb 2018 21:30:21 GMT

The Spring Famework is the most popular framework for Java according to It provides a model view controller (MVC) architecture and readily available components to develop flexible and loosely coupled web applications.

If you are new to Rollbar, it helps you monitor errors in real-world applications. It provides you with a live error feed from the application, including complete stack traces and request data from the browser to debug errors quickly. It lets you easily understand user experience by tracking who is affected by each error. Learn more about our Java error monitoring product features.

Variable Shadowing and Hiding in Java

Fri, 16 Feb 2018 21:01:02 GMT

Java allows us to declare a variable whenever we need it. We can categorize all our variables into three categories, which have different-different scopes:

  1. Instance variables: defined inside a class and have object-level scope.
  2. Class variables: defined inside a class with the static keyword. They have class-level scope common to all objects of the same class.
  3. Local variables: defined inside a method or in any conditional block. They have block-level scope and are only accessible in the block where they are defined.


A Practical Explanation for Initialization Modifiers in Kotlin

Fri, 16 Feb 2018 17:01:48 GMT

Recently, I held a Kotlin Workshop for a client. The workshop's central idea was to spend a couple of hours showing the language itself, going individually through some of its capabilities, and, in the second half, developing a full app able to connect to an API, fetch data, storing it, and displaying it in a RecyclerView.

I found this workshop concept to be apt for an audience new or just starting with Kotlin. Most of the initial concepts are explored or at least touched on, and you have an app with an initial architecture and approach that can, later on, be extended and reused in other professional projects.

Scala: Lazy Evaluation [Presentation]

Fri, 16 Feb 2018 11:01:01 GMT

As per Wikipedia, “Lazy Evaluation is an evaluation strategy which delays the evaluation of an expression until its value is needed.” And today most of the modern programming languages support Lazy Evaluation. In contrast with strict or eager evaluation, which computes values as soon as possible, lazy evaluation can certainly deliver a few benefits, such as:

  • Lazy evaluation can help to resolve circular dependencies

3 Things Every Java Developer Should Stop Doing

Fri, 16 Feb 2018 08:01:01 GMT

From returning null values to overusing getters and setters, there are idioms that we as Java developers are accustom to making, even when unwarranted. While they may be appropriate in some occasions, they are usually forces of habit or fallbacks that we make to get the system working. In this article, we will go through three things that are common among Java developers, both novice and advanced, and explore how they can get us into trouble. It should be noted that these are not hard-and-fast rules that should always be adhered to, regardless of the circumstances. At times, there may be a good reason to use these patterns to solve a problem, but on the whole, they should be used a lot less than they are now. To start us off, we will begin with one of the most prolific, but double-edged keywords in Java: Null.

1. Returning Null

Null has been the best friend and worst enemy of developers for decades and null in Java is no different. In high-performance applications, null can be a solid means of reducing the number of objects and signaling that a method does not have a value to return. In contrast to throwing an exception, which has to capture the entire stack trace when it is created, null serves as a quick and low-overhead way to signal clients that no value can be obtained.

Java 8: Bastion of Long-Term Support

Fri, 16 Feb 2018 05:01:01 GMT

Stephen Colebourne's post "Java 9 has six weeks to live" starts, "Java 9 is obsolete in just six weeks." Colebourne references the Mark Reinhold blog post "Moving Java Forward Faster" and writes, "The new Java release train means that there will be a new release of Java every six months. And when the next release comes out, the previous release is obsolete." Colebourne points out that those still on Java 8 can enjoy this "current LTS (long-term support) release until the next LTS release occurs (Java 11)." However, for those who have already moved to Java 9, different choices must be made and Colebourne outlines these choices at a high level. Colebourne outlines several types of dependencies that must also move forward every six months and concludes, "I think it's fair to say that it's a bold choice to use Java 9 or 10."

As a reminder, the aforementioned Reinhold blog post "Moving Java Forward Faster" outlines how the new proposed release train addresses "the tension between developers, who prefer rapid innovation, and enterprises, which prefer stability, and the fact that everyone prefers regular and predictable releases." The following are key points of this new release train approach:

JDK 9: NotNullOrElse Methods Added to Objects Class

Thu, 15 Feb 2018 21:01:03 GMT

JDK 9 added some new methods to the Objects class including two static methods highlighted in this post: requireNonNullElse(T,T) and requireNonNullElseGet(T obj,Supplier supplier). Both methods make it easier to verify that a given object is notnull and to provide an alternative if the provided variable turns out to be null. As such, these methods and the similar methods introduced to Objects in earlier JDK versions [requireNonNull(T), requireNonNull(T,String), and requireNonNull(T,Supplier)] are most likely to be used to implement guard clauses in methods.

The three methods mentioned in the last paragraph that were added to Objects prior to JDK 9 did not allow a "default" value to be used when the object being tested was determined to be null. Instead, each of these three methods throws a NullPointerException when the variable passed to them is null. The two methods added to Objects in JDK 9 do allow a default to be specified that can be returned by the method rather than the method throwing a NullPointerException.

Java Class Metadata: A User Guide [Presentation]

Thu, 15 Feb 2018 21:01:02 GMT

Last week I presented a talk on the subject of Java Class Metadata at FOSDEM 2018 in the Free Java Room. In my presentation I explained:

  1. What Java Class Metadata is
  2. Why it helps to know about it
  3. What you might do to measure it and reduce the impact of the metadata’s footprint on your Java application

The “too long — didn’t read” summary is:

This Week in Spring: Spring Cloud and Reactive

Thu, 15 Feb 2018 17:01:02 GMT

Hi, Spring fans! Welcome to another installment of This Week in Spring! This week, I’ve been in Munich and Frankfurt, Germany, and Minneapolis, Minnesota, and it looks like I’ll be in New York City and San Francisco for the balance of the week.

We’ve got a lot to cover so without further ado so let’s get started.

Java Quiz 11: Branching Statements

Thu, 15 Feb 2018 11:01:01 GMT

Before we start with this week's quiz, here is the answer to Java Quiz 10: Demonstrating An Anonymous Class

  1. The statement System.out.print(ac.i); writes the value of the instance variable of the class AnonymousClass. So, it writes 5 to the standard output.

Programming BS: Null

Thu, 15 Feb 2018 08:01:01 GMT

I used to watch a TV show called "Penn & Teller Bullsh**!", where a couple of entertainers named Penn and Teller would discuss various issues. At the outset of each episode, Penn would briefly introduce the topic and then point his finger at the screen and say " is bullshit!", with extra emphasis on the last word.

Ever read the article about how NULL is the billion-dollar mistake? I understand the sentiment of null's inventor, and I both agree and disagree. I disagree because the problem isn't null itself, but rather the way we have supported it in languages — and due to that support, I agree we are better off without it.

Error Handling in RxJava/RxKotlin

Thu, 15 Feb 2018 05:01:03 GMT

If you’ve worked with RxJava/RxKotlin, you might be familiar with three methods of a subscriber: onNext, onError, and onComplete. In a reactive stream, elements are consumed by onNext first, and onComplete is called when the stream ends. If you encounter any error in onNext, the complete observable chain is abandoned and control is shifted to the onError method. So, for example, the below code will run perfectly:

        onNext = {
        onComplete = {
        onError = {

Exception Handling With the Chain Of Responsibility

Wed, 14 Feb 2018 21:09:06 GMT

An exception (or exceptional event) is a problem that arises during the execution of a program. When an exception occurs, the normal flow of the program is disrupted and the program/application terminates abnormally, which is not recommended. Therefore, these exceptions are to be handled.

An exception can occur for many different reasons. The following are some scenarios where an exception occurs.