Practical Applications of List Sorting in Java Collections
Requirement Overview
A recent client request required implementing multi-column sorting for a list query.
Analysis Approach
Given the manageable data volume, direct retrieval followed by in-memory sorting using Collections.sort was deemed appropriate.
Implementation Strategy
The solution involved creating a custom comparator to handle complex s ...
Posted on Fri, 09 Oct 2026 16:47:15 +0000 by sualcavab
Understanding Thread-Safe Maps: ConcurrentHashMap vs Hashtable
Thread-Safe Map Implementations
When working with maps in multi-threaded environments, several thread-safe implementations are available:
Collections.synchronizedMap(Map) wrapper
Hashtable
ConcurrentHashMap
Among these, ConcurrentHashMap generally offers the best performance and concurrency characteristics.
Collections.synchronizedMap Impleme ...
Posted on Fri, 02 Oct 2026 16:32:09 +0000 by alant
Java Collections Framework: Algorithms, Lambdas, and Set Implementations
Seven Searching Algorithms and Ten Sorting Algorithms
The java.util.Arrays class provides utility methods for common operations on arrays:
int[] arr = {1, 2, 3, 4, 5, 7, 8, 9, 10};
// toString: converts array to string representation
Arrays.toString(arr); // result: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
// binarySearch: binary search for an elemen ...
Posted on Tue, 29 Sep 2026 16:04:29 +0000 by webbwbb
Sorting and Comparing Java Collections: A Deep Dive into Comparator and Comparable
The Comparable Interface
Comparable is a core Java interface used to define the natural ordering of objects of a custom class. Any class that implements this interface must override the compareTo() method, which encodes the comparison logic between the current object and another instance of the same class.
Usage Example
Classes that implement C ...
Posted on Fri, 18 Sep 2026 16:19:10 +0000 by manamino
Implementing Custom Sorting Strategies in Java Collections
Implementing the Comparable interface establishes a natural ordering for a class. When a domain object overrides compareTo, standard collection utilities can sort instances without external configuration.
import java.util.ArrayList;
import java.util.List;
public class NaturalOrderingDemo {
public static void main(String[] args) {
L ...
Posted on Thu, 17 Sep 2026 16:32:48 +0000 by Eiolon
Java Collections Framework: A Comprehensive Guide to Data Structures
Java Collections Framework Overview
List Interface Implementations
ArrayList
ArrayList is a dynamic array-based implementation of the List interface. It provides fast random access but slower insertions/deletions in the middle.
Characteristics:
Resizable array implementation
O(1) time complexity for get operations
Amortized O(1) for append ...
Posted on Wed, 16 Sep 2026 16:26:21 +0000 by linkin
Python Collections Module: Specialized Container Types
Collections Module Overview
The collections module provides specialized container alternatives to Python's built-in containers like list, dict, set, and tuple. Key components include:
namedtuple: Creates tuple subclasses with named fields
deque: Double-ended queue for efficient appends/pops
Counter: Dictionary subclass for counting hashable ob ...
Posted on Mon, 14 Sep 2026 16:35:40 +0000 by L
Passing Collection Parameters in Java HTTP GET Requests
In Java, two common methods exist for passing collection parameters via HTTP GET requests: URL parameter concatenation and using the @RequestParam annotation. Each approach serves different scenraios.
URL Paramter Concatenation
This method converts collections into comma-separated strings appended to URLs. Suitable for simple data structures.
/ ...
Posted on Mon, 14 Sep 2026 16:15:06 +0000 by bishnu.bhatta
Processing Collections with Java Streams
Understanding Streams in Java
Introduction and Stream Utility
Consider a scenario where you need to filter and process a collection of strings. Given a list of names, the task are: extract names starting with a specific prefix, further filter those by length, and finally display the results.
Example using a traditional approach:
import java.uti ...
Posted on Thu, 10 Sep 2026 16:12:52 +0000 by jemrys
ArrayList Internal Implementation and Capacity Management
Understanding ArrayList's Core Implementation
Analyzing source code effectively requires focusing on specific questions rather than reading sequentially. For ArrayList, a fundamental Java collection class, several key aspects merit examination:
How does ArrayList handle capacity expansion when adding elements?
What specific implementation deta ...
Posted on Thu, 03 Sep 2026 16:45:52 +0000 by qads