Category: Java

Talks about Java

Java Regular Expressions – 3

Character Classes If we browse through java regular expressions, we immediately find a table summarizing regular expression constructs. Yes, that’s what we are going to see here. In below table, the left-hand column specifies the regular expression constructs, while the right-hand column describes the conditions under which each construct will match. Construct Description [abc] a, […]

Java Regular Expressions – 2

String Literals The most basic form of pattern matching is form of String matching. The pattern here is nothing but a simple string search we want to perform on the given input string. From here, let’s take String replace method which accepts a regularExpression and replacementString as arguments. Metacharacters These are the special characters that […]

Java Regular Expressions – 1

What is Java Regular Expressions? From Oracle, it says “Regular expressions are a way to describe a set of strings based on common characteristics shared by each string in the set.” In order to define that common characteristics, we prepare a sequence of characters called ‘Pattern’. These patterns can be used to search, edit, or […]

CopyOnWriteArrayList

Let’s look into below example code. The only difference between these blocks is type of iteration. Example 1 uses Iterator and Example 2 uses for each loop. Running either of above example will result in below exception. So, what this exemption conveys us ? We are not allowed to modify the list during iteration. We […]

Java Interview Questions

1. Core Java CopyOnWriteArrayList Reflection API Threading Difference between Process and Thread Different ways to start a thread Thread lifecycle/states Runnable vs Callable Sleep vs Wait Wait vs Join Thread-Safe ExecuterService Difference between class lock and object lock? Best of Java Multithreading Interview Questions Collections Collection vs Collections Hashmap vs ConcurrentHashmap Set which maintains the […]