Here, in this example, we have two SqlDataSource Controls and they both tied to Authors table of the Pubs database. The first data source control (Marked as 1) supplies data for the grid control (Marked as 3). The second data source control (Marked as 2) supplies the data to the combo box control (Marked as 4). When a user selects a state in the combo box, the DataGrid will update the authors listed in the DataGrid.
In the past Java HashSet example, we learnt about the Java HashSet and its Set implementation and how it keeps the uniqueness. Now, in this example, we will learn about the Buckets and how it aids quicker retrieval and search. These buckets improve the performance of search action and this example will research how these bucketing concepts work with HashSet Class and hashCode override of its stored object.
Before we learn about Java hashSet class, we will learn about the Set interface. Because the HashSet class implements Java Collection’s Set interface. The Set Interface ensures the implementing class to hold uniqueness in the collection. Means, it does not allow duplicate items. In Java Collection framework, the below classes implement the Set interface:
There were other classes as well. But here we listed frequently used ones. In this example, we will explore about the HashSet collection class.
Like Iterator, the Java ListIterator also a special reference over the collection of objects. In the past example on Java Iterator, we saw that it can only remove the collection items. But, the ListIterator can remove as well as add items to the collection while iteration is in progress. Unlike the Iterator, the ListIterator can iterate the collection in both forward and backward directions. So, the ListIterator is called a Bi-Directional Cursor.
In this example, we will use the ArrayList of Fruits and learn how ListIterator works. Let us start.
The Java Iterator is a reference over a collection object. It can be ArrayList, LinkedList anything which implements the basic Collection Interface. With the iterator we can get all the items in the collection one by one. We can iterate over the collection via a loop or via a for-each construct. But, using these, we cannot adjust the structure while the iteration is in-progress. Whereas with Java Iterator, we can remove items while the iteration is going on.
Java Iterator is a Forward-Only Cursor. This means one can iterate the collection items only in forward direction. Standard Java Iterator does not allow the reverse way of iteration. Also, note the Standard Java Iterator does not allow adding the items even though it allows removal. In this example, we will learn about the Iterator using an ArrayList collection object.