Home » Java » Core Java

Core Java

Handling Exceptions In Java

Every programmer wants to write a flawless program. That is, a program that runs without any hitch or glitch. Well, if wishes were horses, beggars would ride. Beyond all the wishes of a programmer, sometimes unforeseen circumstances happen. These unforeseen circumstances are generally categorized as ”exceptions” in Java. Exceptions interfere with the smooth running of our code and terminate the ...

Read More »

Learning to use Wholly GraalVM!

Introduction In the post Truffle served in a Holy Graal: Graal and Truffle for polyglot language interpretation on the JVM, we got a brief introduction and a bit of deep dive into Graal, Truffle and some of the concepts around it. But no technology is fun without diving deep into its practicality, otherwise its like Theoretical Physics or Pure Maths ...

Read More »

Split a File as Stream

Last week I discussed that the new (@since 1.8) method splitAsStream in the class Pattern works on the character sequence reading from it only as much as needed by the stream and not running ahead with the pattern matching creating all the possible elements and returning it as a stream. This behavior is the true nature of streams and it ...

Read More »

Functional Java by Example | Part 2 – Tell a Story

This is part 2 of the series called “Functional Java by Example”. The example I’m evolving in each part of the series is some kind of “feed handler” which processes documents. In previous part I started with some original code and applied some refactorings to describe “what” instead of “how”. In order to help the code going forward, we need ...

Read More »

A Tale of Two Iterators

When you look at the most popular Java interview questions, you might encounter the one about fail-fast and fail-safe iterators: What’s the difference between fail-fast and fail-safe iterators? The simplified answer is that: Fail-fast iterator throws ConcurrentModificationException if the collection is modified while iterating, but fail-safe doesn’t. Even though it totally makes sense, it’s not clear what the interviewer means ...

Read More »

[MEGA DEAL] Complete Java Programming Bootcamp (94% off)

10 Courses (83.5 Hours) to Become a Java Master: Design UIs with JavaFX, Utilize Design Patterns, Master Multithreading & More Hey fellow geeks, This week, on our JCG Deals store, we have another extreme offer. We are offering a massive 94% off on Complete Java Programming Bootcamp. Get it now with only $39, instead of the original price of $740. ...

Read More »

Java Optionals For More Expressive Code

Any of us who has programmed in a language that permits null references will have experienced what happens when you try to dereference one. Whether it results in a segfault or a NullPointerException, it’s always a bug. Tony Hoare described it as his billion-dollar mistake. The problem typically occurs when a function returns a null reference to a client that was ...

Read More »

Easily Return Values From a Transaction with Speedment 3.0.17 or Later

Transactions In my previous post, I wrote about how to use Transactions in an easy way using Speedment where we updated two bank accounts atomically. As you all might know, transactions are a way of combining a number of database operation into a single operation that is atomically executed. But transactions are not only about updating the database but also about ...

Read More »