In Java, subList() creates a sub-list from a larger list, but it can throw an exception if you give it invalid starting or ending positions. Learn how to avoid this error.
Search Results for: sub
Find the Length of the Longest Symmetric Substring
Learn how to handle the symmetric substring expansion methods, taking into account the specific requirements such as input size and computational efficiency.
@Subselect Annotation in Hibernate
Learn how to use @Subselect to select entities not from a particular table but from a sub-select query.
Difference Between execute() and submit() in Executor Service
Explore the key differences between execute() and submit() in Executor Service.
Finding the N-th Occurrence of a Substring in a String in Java
Learn various ways to locate the n-th occurrence of a substring within a string using iterative, recursive, and regex-based solutions.
How to Subscribe a Kafka Consumer to Multiple Topics
Learn three different methods of subscribing a Kafka consumer to multiple topics.
Inner Classes vs. Subclasses in Java
Explore subclasses, inner classes, and their role in writing modular object-oriented code.
@JsonSubTypes vs. Reflections for Polymorphic Deserialization in Jackson
Explore two distinct approaches, focusing on using a custom annotation and Reflections, for identifying and registering subtypes.
Split a String Into Digit and Non-Digit Substrings
Explore different approaches and techniques for breaking an input string into a string array or list containing digit and non-digit string elements in the original order
Subtract Days from a Date in Java
Explore several ways to subtract days from a date object.
Get a Submap From a HashMap in Java
A quick and practical guide to deriving a submap from a HashMap in Java.
Pub-Sub vs. Message Queues
In this tutorial, we’ll look at the use of message queues and publishers/subscribers. These are common patterns used in distributed systems for two or more services to communicate with one another.
Multiple Submit Buttons on a Form
Learn how to add another button to the same form in a Spring MVC application that maps to the same RequestMapping on the controller.
Security Context Basics: User, Subject and Principal
A quick overview of basic terms associated with the security context.
Liskov Substitution Principle in Java
The L in SOLID, the Liskov Substitution Principle helps structure object oriented design. We also explore how it supports the Open/Closed Principle.
Get Substring from String in Java
The practical ways of using the useful substring functionality in Java – from simple examples to more advanced scenarios.
Maximum Subarray Problem in Java
Discover two approaches for solving the maximum subarray problem using Java.
Checking If a String Is a Repeated Substring
Learn two ways of checking if a String consists only of its substrings in Java.
Check If a String Contains a Substring
Explore various ways to search for a substring in a String with performance benchmarks
Find Substrings That Are Palindromes in Java
Learn several algorithms for finding all palindromes within a given string in Java.