Java TreeSet headSet(E toElement, boolean inclusive) Method Example

We have already seen the usage of headSet(E toElement) method of java.util.TreeSet class  which will return the view of the portion of this set whose elements are strictly less than toElement. where as headSet(E toElement, boolean inclusive) method will return a view of the portion of this set whose elements are less than or equal to if inclusive is true. [Read more…]