Browse by Topic

Popular

Latest

Latest Java Posts

Illustration of a generic method with type parameter T in Java
Java

Java Generic Method: Syntax and Practical Usage

Learn how to declare and use generic methods in Java, including type inference, bounds, wildcards, and runtime behavior.

Java genericsgeneric methodstype parameterstype erasure
Illustration of a Java generic class concept showing a box with a type parameter T and type safety.
Java

Java Generic Class: Syntax, Bounds, and Type Erasure

Learn how to declare and use Java generic classes, including bounded type parameters, wildcards, and the implications of type erasure at runtime.

genericstype safetytype erasurebounded type parameters
Illustration of Java generics showing a type-safe container with compile-time checks and type erasure at runtime.
Java

Java Generics: Type Safety and Runtime Behavior

Understand Java generics, including type erasure, wildcards, and practical patterns for writing type-safe, reusable code.

type-safetywildcardstype-erasuregeneric-methods
A Java list wrapped by a synchronization lock, representing thread-safe collection access.
Java

Using Collections.synchronizedList in Java

java collections synchronizedlist: Learn how Collections.synchronizedList works, when it guarantees thread safety, and where manual synchronization is still required.

ConcurrencyThread SafetyCollections FrameworkSynchronization
A Java code snippet showing an unmodifiable list being created from a mutable list, with a lock icon indicating immutability.
Java

Java Collections UnmodifiableList: How to Create and Use

Learn how to create unmodifiable lists in Java with Collections.unmodifiableList(), List.of(), and Collectors.toUnmodifiableList(), including behavior and pitfalls.

javamain_keyword
Illustration of swapping two elements in a Java list, showing index exchange
Java

java collections swap: How to Swap Elements in Lists and Arrays

java collections swap: Learn how to swap elements in Java collections and arrays using Collections.swap, manual index-based swapping, and understand performance tradeo...

JavaCollectionsSwapList
Illustration of Java Collections.fill replacing list elements with a single value
Java

Java Collections fill: Replacing List Elements

Learn how to use Java's Collections.fill to replace all list elements with a single value, including behavior, pitfalls, and performance.

java collectionsfill methodlist manipulationjava util
An illustration of a magnifying glass hovering over a stack of colored cards representing Java collection elements, with a counter badge showing the number of matches.
Java

Java Collections Frequency: Counting Occurrences

Learn how to use Collections.frequency() to count occurrences in Java collections, including equality rules, nulls, maps, performance, and when a frequency map or stream is the better choice.

Java CollectionsCollections.frequencyJava APIJava Streams
Illustration of a Java collection with numbers and arrows indicating the minimum and maximum values.
Java

Finding Min and Max in Java Collections

java collections min max: Learn how to find the minimum and maximum values in Java collections using Collections and Stream API, with custom comparators and empty coll...

JavaCollectionsStream APIComparator
Java Collections shuffle method randomizing a list of playing cards
Java

How to Shuffle Collections in Java

Learn how to use Collections.shuffle() to randomize List elements, control randomness with a custom Random, shuffle arrays, and avoid common pitfalls.

CollectionsRandomizationListFisher-Yates