Java Core (java-core)

Controlling Time with Java Clock

Use java.time.Clock to control time in your unit tests. This article will mainly focus on usage of fixed clock and offset clock.

Introduction of Immutables

Introduction of Java framework Immutables which creates immutable objects and builders for you. Type-safe, null-safe and thread-safe, with no boilerplate.

Unzipping File in Java

Unzipping zip file in Java 8 using builtin Java classes: ZipInputStream and ZipEntry. Implementation supports sub-directories as well.

Testing with GwtMockito

My recent bug fixing experience on Google Web Kit (GWT) with GwtMockito: problem understanding, code refactoring, mocking framework preparation, testing, and comparison between GwtMockito and GWTTestCase.

6 Tips for Fixing Bugs with Legacy Frameworks

In my daily work, I have to deal with legacy frameworks. Here are 6 tips that I summarized for bug-fixing, including documentation, searching, testing, patching library and more.

Fixing Comparator

Fun experience on fixing a custom comparator by identifying the sub-problems, testing different combinations, and finally fix it.

Viewing the Contents of JAR

Listing files inside a JAR or displaying content of a single file using different commands: "jar", "unzip", or "vim".

Glob Expression Understanding

Glob expression syntax, and its usage in Java through Path Matcher and Directory Stream.

Understanding ISO-8859-1 / UTF-8

Character mapping between ISO-8859-1 / UTF-8, decode and encode data between string and bytes, and file I/O operations including MIME encoding detection. All examples are written in Java and Python 3.

Design Pattern: Static Factory Method

Understand static factory method pattern in Java with concrete examples from Selenium WebDriver, Jackson JSON object mapper, and SAX reader for XML.

Vavr List vs Java List

Difference between Vavr List and Java List? I'll compare them via CRUD operations, immutability, performance, streaming, and thread safety in this article.

VAVR HashMap vs Java HashMap

What is the difference between VAVR Collection API and Java Collection API? Why should you give it a try? Today, we will start comparing them via Map and HashMap, including the map creation, entries iteration, streaming, and the side effect.

Why You Should Use Auto Value in Java?

Auto Value generates immutable value classes during Java compilation, including equals(), hashCode(), toString(). It lighten your load from writing these boilerplate source code.

Use Auto Value and Jackson in REST API

This post explains what is Google Auto Value and why it is the best alternative for Data Transfer Objects (DTO) in your web service. It shares how to apply Jackson annotations on top of Auto Value classes. There're also some advanced configurations about this topic.

Learning HashMap

Understand java.util.HashMap in Java 11: bitwise operations, hash computation using hash code, index calculation, and more.

Java 9 Migration

Java 9 migration for Maven project. It consists Java 9 installation, IDE update, Maven project update, CI update, and fixing tests. This article is written using macOS and IntelliJ IDEA.

OCP Java 8 Review Notes

Here're some review notes before my Oracle Certified Professional Java SE 8 exam. They're highly inspired by the following books: OCP Java SE 7 Certification Guide and Java 8 in Action. They are excellent resources for learning Java, which I highly recommend.

OCA Review 8 - Notes

Today, I want to write blog post to summarize all the important review notes for Oracle Certification Associate (OCA) - Java SE 8 Programmer. This article will be separated into several subjects: Java basics, Java data types, methods and encapsulation, core APIs, flow control, inheritance, and exception handling.

OCA Review 7 - Online Test Chapter 5

Today, I’m going to review my online test, chapter 5 of Oracle Certified Associate (OCA), provided by SYBEX. If you need to access to this online resources, you need to buy their book first. See https://sybextestbanks.wiley.com/.

OCA Review 6 - Online Test Chapter 4

Today, I’m going to review my online test, chapter 4 of Oracle Certified Associate (OCA), provided by SYBEX. If you need to access to this online resources, you need to buy their book first. See https://sybextestbanks.wiley.com/.

OCA Review 5 - Online Test Chapter 3

Today, I’m going to review my online test, chapter 3 of Oracle Certified Associate (OCA), provided by SYBEX. If you need to access to this online resources, you need to buy their book first. See https://sybextestbanks.wiley.com/.

OCA Review 4 - Online Test Chapter 2

Today, I’m going to review my online test, chapter 2 of Oracle Certified Associate (OCA), provided by SYBEX. If you need to access to this online resources, you need to buy their book first. See https://sybextestbanks.wiley.com/.

OCA Review 3 - Online Test Chapter 1

Today, I’m going to review my online test, chapter 1 of Oracle Certified Associate (OCA), provided by SYBEX. If you need to access to this online resources, you need to buy their book first. See https://sybextestbanks.wiley.com/.

OCA Review 2 - Java Core APIs

I’m preparing the OCAJP: Oracle Certified Associate Java SE 8 Programmer. Here’s the second review of the certification training. In this review, I’ll talk about the Java Core APIs, including operations of String, StringBuiler, Arrays, ArrayList, and Java Time in Java 8.

OCA Review 1 - Java Basics

I’m preparing the OCAJP: Oracle Certified Associate Java SE 8 Programmer. Here’re something interesting that I learned from the study guide, chapter 1 and chapter 2. They’re rarely used in our daily mission, but I just wrote them down for fun.

Convert Date to ISO 8601 String in Java

Convert Java dates to ISO-8601 string: this post explains how to convert java.util.Date, java.util.Calendar, java.time.ZonedDateTime to string.