Java Reflection: Modifying Private Static Final Fields

While debugging memory leaks, I often need to modify field values via reflection. I came across a great Stack Overflow answer worth documenting. ...

June 16, 2015 · 2 min · haoxiqiang

Gson User Guide

This article is compiled from the official Gson User Guide. Gson’s performance is competitive with other JSON frameworks, and being Google-maintained makes it a solid choice for Java/Android JSON processing. Gson is a Java library developed by Google for serializing Java objects to JSON and deserializing JSON strings back to Java objects. ...

June 8, 2015 · 4 min · haoxiqiang

Cache Algorithms

Cache replacement policies determine which entries to evict when the cache is full. They have a direct impact on system performance. Here is an overview of common cache eviction algorithms. ...

May 5, 2015 · 2 min · haoxiqiang

Design Patterns

Design Patterns are reusable solutions to common problems in object-oriented design. The 23 classic patterns were systematized by the Gang of Four (GoF: Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides) in their 1994 book Design Patterns: Elements of Reusable Object-Oriented Software. This article is compiled from a blog post by smallnest and a StackOverflow discussion on GoF design pattern implementations in the Java API. View PDF Overview ...

March 30, 2015 · 5 min · haoxiqiang

How Java HashMap Works Internally

HashMap is one of the most frequently asked topics in Java interviews — it effectively tests a candidate’s understanding of data structures and engineering trade-offs. This article breaks down its core design and implementation details. ...

December 27, 2014 · 5 min · haoxiqiang

Lambda Expressions in Java 8

What is a Lambda Expression? Lambda expressions are a core feature introduced in Java 8, enabling more concise code. Here is the most straightforward example: 1 2 3 4 5 6 7 8 9 10 Runnable runnable1 = new Runnable() { @Override public void run() { System.out.println("runnable1 start!!!"); } }; Runnable runnable2 = () -> System.out.println("runnable2 start!!!"); runnable1.run(); runnable2.run(); Both blocks are equivalent, but the lambda version is a single line. The basic form is () -> expression or () -> { statements; }. ...

December 7, 2014 · 3 min · haoxiqiang