Java TreeSet subSet(E fromElement, E toElement) Method Example

Previously we have seen about subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) method of java.util.TreeSet class which returns a view of the portion of this set whose elements range from fromElement to toElement. whereas subSet(E fromElement, E toElement) method returns a view of the portion of this set whose elements range from fromElement(inclusive) upto toElement(exclusive)

[Read more…]