effectively final in Java 8
In Java 8 with the addition of lambda expressions, a new concept effectively final variable has been added, which closely relates to lambda expressions. Prior to Java 8, inner classes had an important...
View ArticleBlockingDeque in Java
BlockingDeque interface (added in Java 6) is a Deque that provides additional support for blocking operations. Here blocking the opearations mean that the operation will wait for the deque to become...
View ArticlePriorityBlockingQueue in Java
PriorityBlockingQueue class was added in Java 5 and it implements the BlockingQueue interface. PriorityBlockingQueue class uses the same ordering rules as the PriorityQueue class. In fact...
View ArticleSynchronousQueue in Java
SynchronousQueue which is an implementation of the BlockingQueue interface was added in Java 5 along with other concurrent utilities like ConcurrentHashMap, ReentrantLock, Phaser, CyclicBarrier etc....
View ArticleDelayQueue in Java
DelayQueue which is an implementation of BlockingQueue interface is added in Java 5 along with other concurrent utilities like CyclicBarrier, Exchanger, ConcurentSkipListMap, CopyOnWriteArraySet etc....
View ArticleConcurrentLinkedQueue in Java
ConcurrentLinkedQueue implements Queue interface and it was added in Java 5 along with other concurrent utilities like CyclicBarrier, CountDownLatch, Semaphore, ConcurrentHashMap...
View ArticleLinkedTransferQueue in Java
LinkedTransferQueue is added in Java 7 and it is an implementation of TransferQueue interface. TransferQueue interfaceIt will be worthwhile to spend some time knowing the TransferQueue interface here....
View ArticleAutowiring using XML configuration in Spring
Spring framework provides an option to autowire the beans. In that case you don't need to explicitly wire the bean properties (using ref attribute) but Spring will do it automatically by using the...
View ArticleAutowiring using annotations in Spring
Though autowiring of the beans can be done using XML configuration for autowiring but Spring goes one step further and provides autowiring using annotations which leads to shorter and more concise...
View ArticlePrint odd-even numbers using threads and wait-notify
This Java program prints odd-even numbers sequentially using two threads. One thread generates odd numbers and another even numbers. This program makes use of inter-thread communication using wait,...
View ArticlePrint odd-even numbers using threads and semaphore
This Java program prints odd-even numbers sequentially using two threads. One thread generates odd numbers and another even numbers.This program makes use of inter-thread communication using Semaphore...
View ArticleLinkedBlockingDeque in Java
LinkedBlockingDeque is an implementation of the BlockingDeque interface and it was added in Java 6.LinkedBlockingDeque is an optionally bounded deque and it stores its elements as linked nodes. Since...
View ArticleProducer-Consumer Java program using wait notify
This Java program solves the Producer-Consumer problem using threads and wait notify. Where one(Producer) thread produces data and another(consumer) thread retrieves it. Refer Producer-Consumer Java...
View ArticleProducer-Consumer Java program using ArrayBlockingQueue
This Java program solves the Producer-Consumer problem using threads and ArrayBlockingQueue which is an implementation of the BlockingQueue interface. Refer Producer-Consumer Java program using wait...
View ArticleAutodiscovery of bean using componenent-scan in Spring
In the post how to autowire using XML config or how to autowire using annotation you have already seen how Spring can automate the injection of dependencies. That helps in cutting down the...
View ArticleDifference between component-scan and annotation-config in Spring
To get the difference between annotation-config element and component-scan element you have to know about two terms - Autowiring of beansAutodiscovery of beansAutowiring of beansWhen you use only XML...
View ArticleCheck if given strings are anagram or not - Java program
Write a Java program to find whether the given strings are anagrams or not is a frequently asked Java interview question. Some other frequently asked Java programs are counting chars in a string and...
View Article@Resource annotation in Spring autowiring
Apart from supporting JSR-330 annotations like @Inject and @Named for autowiring, Spring also supports injection using the JSR-250 @Resource annotation on fields or bean property setter...
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 has a feature called executors that provides an alternative to...
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 Article