ReentrantLock Example Java Concurrency ReentrantLock in Java is added on java.util.concurrent package in Java 1.5 along with other concurrent utilities like CountDownLatch, Executors. ReentrantLock is one of the most useful addition in Java concurrency package […]
Posts Tagged: Core Java
Life cycle of a thread in Java: Understanding Thread Life Cycle and Thread States are very important when you are implementing Threads and multi-threaded programming for your application. Thread States Below diagram shows different states […]
Multitasking and Multithreading With Real World Example Multitasking Multitasking is a technique where multiple tasks, also known as processes, share common processing resources such as CPU, Memory etc. With a multitasking OS, such as Windows […]
What is ThreadLocal in Java example – ThreadLocal class can be used in multi threaded environment and provides thread-local variables that is local to each thread. Thread that accesses thread local variable (via its get […]
Difference between List and Set in Java Collections – List Set List in Java allows duplicate elements. Set doesn’t allow any duplicate. If you insert duplicate in Set it will replace the older value. […]
Find duplicate elements in ArrayList – This example will show, how to find no of duplicate item occurrence from a ArrayList. 1) No of item occurrence for a single item 2) No of occurrence of […]
how to create custom checked exception – We can create our own exceptions by extending ‘Exception’ class. Below example will show you how to create custom exception by extending Exception class. It is a checked […]
How to use stopwatch in JAVA – guava stopwatch Some times we want to check the how much time taken for a particular functionality, method or a statement. By using stopwatch it is to much […]
Full-Text Search with Apache Lucene in Java – Latest Version: Apache Lucene 4.7.0 What is Lucene? Apache Lucene is a high-performance, full-featured text search engine library written in Java. It is a technology suitable for […]
Text search in all file inside a directory with apache lucene 4.7 Below program will search inside all files in a directory – In this example program I have searched with “Gopal”. It will search […]