Java TreeMap headMap(toKey,inclusive) Method Example

Previously we have seen the usage of  headMap(K toKey) method of java.util.TreeMap class which returns the view portion of this map whose keys are strictly less than toKey. Whereas headMap(K toKey,boolean inclusive) method returns a view of the portion of this map whose keys are less than (or equal to, if inclusive is true)toKey.
[Read more…]