We have already seen about how to inject dependency to a List and Set Collection, now we will look into Spring Dependency injection to a Map java collection. As we all know Map uses key, value pair to store the values. A pair of key and value is called as a entry. We will be using the <entry> tag in our configuration file to inject values. … [Read more...]
Spring Dependency Injection With Set Collection Example
Previously we have let about Spring Dependency Injection With List Collection, There will not be much of difference between list and set,except we will be having Set in all the places of list. Lets see how to inject values to the Set Collection. We will be injecting String values to a Set and Objects to another Set using <set> tag in our configuration file. … [Read more...]
Spring Dependency Injection With List Collection Example
In my previous article we have already learnt about the Dependency Injection in Spring and Setter Injection in the form of Primitives and injection in the form of Objects. Spring support injection in the form of the collection as well, it supports the below collections. … [Read more...]
How to use Java Collections Queue in Java
The Queue interface is a subtype of java.util.Collection interface. This represents an Ordered list of the object where elements inserted at the end of the queue, and elements removed from the beginning of the queue. … [Read more...]
How to remove an element from collection using Iterator Example
We have learnt how to iterate a collection using iterator, now lets see how to remove a element from a collection while iterating itself. The remove() method of the iterator will let us remove the element from the underlying collection. … [Read more...]
How to Iterate a collection using Java Iterator Example
We can iterate a collection using the Iterator object(). The iterator has two methods which will let you iterate. The hasNext() method returns True when the collection has more elements in it and next() method returns the next element. … [Read more...]