CollectionUtils removeAll method

In this post under Apache Collections, I will explain with example the purpose of “CollectionUtils” class “removeAll” method. This method takes two collections i.e, “collection1” and “collection2” as an arguments. This method searches for elements in “collection2” in “collection1”. If the element is found in “collection1”, it is removed. Basically, it returns a collection say…… Continue reading CollectionUtils removeAll method

Permutations of collection elements

In this post under Apache collections, I will explain with example, how to generate a collection of possible permutations of a particular collection elements. If we have collection of elements, we can generate a list of different permutations containing the same elements. The Apache Collections tool, has a “permutations” method in “CollectionUtils” class. This method…… Continue reading Permutations of collection elements

Comparing two collections for equality

In this post under Apache Collections, I will show with example how to compare two collections for equality. We consider two collections are equal if they have same elements repeated same number of times. The Apache Collections tool has “isEqualCollection” method on “CollectionUtils” class which we can use to compare two collections for equality. Below…… Continue reading Comparing two collections for equality

HaveIBeenPwnedRule setAllowOnException method example

In previous post under Passay, I showed with example how to use “HaveIBeenPwnedRule” rule. Just for recap, there is a website “haveibeenpwned.com” that contains a list of real world passwords that were previously used and exposed as part of data breaches. This rule will check user enteredpassword against that database. If password is already present,…… Continue reading HaveIBeenPwnedRule setAllowOnException method example

HaveIBeenPwnedRule setAllowExposed method example

In previous post under Passay, I showed with example how to use “HaveIBeenPwnedRule” rule. In this post, I will explain with example the purpose of “setAllowExposed” method of “HaveIBeenPwnedRule” rule class. Just for recap, there is a website “haveibeenpwned.com” that contains a list of real world passwords that were previously used and exposed as part…… Continue reading HaveIBeenPwnedRule setAllowExposed method example

Autowiring interface with multiple implementation

Autowiring interface with multiple implementation In this post, I will explain with example how to inject a bean whose type is an interface (Java Interface or Abstract class) and it has multiple classes that implements it. In the previous post, I showed how Spring Framework inject a bean whose type is an interface and has…… Continue reading Autowiring interface with multiple implementation

Autowiring interface with single implementation

In all my previous posts under Spring Core, I showed how to inject a bean belonging to a particular class. But in reality, to maintain a loose coupling we program to an interface and not to a class. (Interface doesn’t represent Java Interface. Here Interface is generic term that represents either Java Interfaceor Java Abstract…… Continue reading Autowiring interface with single implementation

Autowiring By Name (@Qualifier annotation)

In this post under Spring Core, I will explain with example how to autowire beans based on names instead of bean type. Till now in all our previous posts, beans to be injected were figured out by the class type. Sometimes there exist a situation where when Spring framework tries autowire a bean of a…… Continue reading Autowiring By Name (@Qualifier annotation)