ConcurrentHashMap in Java
From Java 5 ConcurrentHashMap is introduced as another alternative for HashTable(or explicitly synchronizing the map using synchronizedMap method). Though we have an option to synchronize the...
View ArticleCopyOnWriteArrayList in Java
Though we have an option to synchronize the collections like List or Set using synchronizedList or synchronizedSet methods respectively of the Collections class but there is a drawback to this...
View ArticleJava Multi-Threading Interview Questions
In this post Java multithreading interview questions are listed. This compilation will help the Java developers in preparing for their interviews.What is thread in Java?According to JavaDoc A thread is...
View ArticleHow to Format Date in Java Using SimpleDateFormat
If you want to create your own customized formats for formatting the date in Java, you can do that using the SimpleDateFormat class.When you create a SimpleDateFormat object, you specify a pattern...
View ArticleCallable and Future in Java Concurrency
Callable, an interface, was added in Java 5. It allows you to define a task to be completed by a thread asynchronously.You must be wondering, there is already a Runnable interface, with its run()...
View ArticleExecutor and ExecutorService in Java Concurrency
In large-scale applications, its good to separate thread management and creation from the rest of the application. The concurrent API in Java has a feature called executors that provides an alternative...
View ArticleJava Concurrency Interview Questions
In this post Java Concurrency Interview Questions are listed. This compilation will help the Java developers in preparing for their interviews.What is CountDownLatch in Java concurrency? CountDownLatch...
View ArticleBean Definition Inheritance in Spring
In object-oriented programming there is a parent-child relationship among classes where child class inherits properties and methods of the parent class through inheritance. Same concept of inheritance...
View ArticleReading Delimited File in Java Using Scanner
In this post we'll see how to read delimited file (like CSV) in Java using Scanner class.A Scanner, when reading input, breaks its input into tokens using a delimiter pattern, which by default matches...
View ArticleReading File in Java 8
If anybody asks to point out two most prominent new features of Java 8, I guess most of the people will say Lambda expressions (along with Stream API) and interface default methods. These are...
View ArticleZipping Files in Java
In this post we'll see how to zip a single file in Java and also how to zip files recursively in Java to compress a whole directory.In Java, java.util.zippackage provides classes for data compression...
View ArticleSequence File in Hadoop
Apart from text files Hadoop framework also supports binary files. One of the binary file format in Hadoop is Sequence file which is a flat file consisting of binary key/value pairs. Advatntages of...
View ArticleHow to Append to a File in Java
In the post writing file in Java we have already seen how to write to a file in Java but the code given there creates a new file every time and writes the lines in the file. But there are many cases...
View ArticleDifference Between Runnable And Callable in Java
Differences between Callable and Runnable in Java is a frequently asked Java concurrency interview question and that is the topic of this post.Runnable interface is around from JDK 1.0 where as...
View ArticleStampedLock in Java
In Java 8 a new kind of lock StampedLock is added which apart from providing separate read and write locks also has a feature for optimistic locking for read operations. StampedLock in Java also...
View ArticleAtomicLong in Java Concurrency
AtomicLong class in Java provides a long value that may be updated atomically. This class resides in the java.util.concurrent.atomicpackage which has classes that support lock-free thread-safe...
View ArticleHow to Read And Write SequenceFile in Hadoop
In this post we’ll see how you can read and write a sequence file using Java API in Hadoop. We’ll also see how to read and write sequence file using MapReduce. Java program to write a sequence...
View ArticleInsert\Update Using JDBCTemplate in Spring Framework
In the post Data access in Spring framework we have already seen how Spring provides templates for various persistence methods and how templates divide the data access code into fixed part and variable...
View ArticleSelect Query Using JDBCTemplate in Spring Framework
In the post Insert\Update using JDBCTemplate in Spring framework I have already discussed how JDBCTemplate can be used for inserting and updating data in the DB. I left behind the part to read from...
View ArticleConfiguring DataSource in Spring Framework
In the post Data access in Spring framework it is already discussed in detail that Spring framework uses templates with fixed and call back parts in order to reduce the boiler plate code. In order to...
View Article