Browse by Topic

Popular

Latest

Latest Java Posts

Diagram showing a string literal pointing to a shared pool while two new String objects occupy separate heap locations
Java

Java String Pool vs Heap: Where Strings Live

java string pool vs heap: Understand how Java stores strings in the pool versus the heap, how interning works, and when each approach fits your memory needs.

String PoolJava MemoryString InterningJVM Internals
Diagram showing Java string pool and intern method referencing shared string instances
Java

Java intern method: How String Interning Works

Learn how Java's String.intern() method works, its effect on memory and performance, and when to use it safely in production code.

String interningJava String poolJVM memoryJava performance
Diagram showing multiple string references pointing to a single pooled string object in the JVM heap
Java

Understanding the Java String Pool

How the JVM string pool works: when strings are pooled, how intern() affects memory, and common pitfalls with string comparison.

JVMString InterningMemory ManagementJava Performance
Illustration of a Java StringBuilder showing the length method returning the number of characters in a mutable string buffer.
Java

Java StringBuilder length: How to Get the Character Count

Learn how to get the current character count of a Java StringBuilder, how length differs from capacity, and why length() is O(1).

JavaStringBuilderString LengthMutable Strings
Illustration of Java StringBuilder capacity growth showing an internal array expanding to accommodate more characters.
Java

Java StringBuilder Capacity Explained

Understand Java StringBuilder capacity, including its default value, growth behavior, and how to set it to avoid unnecessary reallocations.

StringBuilderJavaCapacityPerformance
Diagram showing a StringBuilder object with characters reversed in place, illustrating the Java StringBuilder reverse method.
Java

How to Use StringBuilder.reverse() in Java

See how StringBuilder.reverse() works in Java: in-place mutation, Unicode surrogate-pair handling, performance, and common pitfalls.

StringBuilderString reversalJava string handlingUnicode
Diagram showing a StringBuilder buffer with a character range being replaced by a new string in place.
Java

Java StringBuilder replace: In-Place Substring Editing

Learn how StringBuilder.replace(int start, int end, String str) edits strings in place with inclusive start and exclusive end indices, including edge cases and performance trade-offs.

JavaStringBuilderString manipulationMutable strings
Diagram showing character removal from a mutable string buffer in Java.
Java

Java StringBuilder delete: Remove Characters Efficiently

java stringbuilder delete: Learn how to use StringBuilder.delete() and deleteCharAt() to remove characters efficiently in Java, with index boundary rules and performan...

StringBuilderJava StringString ManipulationdeleteCharAt
A Java StringBuilder object with an insert operation visualized, showing a character being placed at a specific index in a mutable string sequence.
Java

Java StringBuilder insert: Syntax and Examples

java stringbuilder insert: Learn how to use StringBuilder.insert() in Java: syntax, overloads, common patterns, and performance considerations for efficient string bui...

StringBuilderJava StringString ManipulationJava Performance
Diagram showing a StringBuilder buffer being extended by append operations, with the final toString result.
Java

Java StringBuilder append: Syntax and Performance

java stringbuilder append: Learn how Java StringBuilder append builds strings efficiently, covering syntax, chaining, capacity growth, and when it beats concatenation.

StringBuilderString ConcatenationJava PerformanceMutable Strings