Binary Search on ArrayList in java

Before performing binary search operation on list: Sort the given list in ascending order using sort(List) method. See the highlighted portion showing Collections.sort(javaRadarList); in the given program below. After sorting, make call to binary search method. See the second highlighted method call Collections.binarySearch(javaRadarList, “Spring”); Here first parameter is the list while

TreeSet in java

TreeSet is a class that implements Set interface and extends AbstractSet class. By default, elements in TreeSet class is stored in ascending order (see example given below). Key feature of TreeSet 1.     TreeSet contains only unique elements. 2.     Maintains ascending order (by default).  3.     Access and retrival time is fast in TreeSet. Now let’s look