Interface SortedMap<K,V>
- All Known Implementing Classes:
AbstractSortedMap
,TreeMap
SortedMap defines the interface for maps that are sorted by their key.
-
Method Summary
Modifier and TypeMethodDescriptionReturns an immutable view of this map as an instance ofjava.util.SortedMap
.Comparator
<? super K> Returns the comparator associated with this map, ornull
if the default ordering is used.drop
(int number) Returns a map containing all elements in this map, excluding the firstnumber
of elements.first()
Returns the first entry in the map ornull
if the map is empty.Returns the bottom of the map starting from the key specified.last()
Returns the last entry in the map ornull
if the map is empty.Returns a map with the value specified associated to the key specified.Returns a subset of the map between thefrom
andto
keys specified.Returns a map with the value associated with the key removed if it exists.take
(int number) Returns a list containing the firstnumber
of elements from this list.Returns the top of the map up until the key specified.Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface com.github.andrewoma.dexx.collection.Map
asMap, containsKey, get, keys, values
Methods inherited from interface com.github.andrewoma.dexx.collection.Traversable
forEach, isEmpty, makeString, makeString, size, to, toArray, toArray, toIndexedList, toSet, toSortedSet
-
Method Details
-
put
Description copied from interface:Map
Returns a map with the value specified associated to the key specified.If value already exists for the key, it will be replaced.
-
remove
Description copied from interface:Map
Returns a map with the value associated with the key removed if it exists. -
from
Returns the bottom of the map starting from the key specified.- Parameters:
inclusive
- if true, the key will be included in the result, otherwise it will be excluded
-
to
Returns the top of the map up until the key specified.- Parameters:
inclusive
- if true, the key will be included in the result, otherwise it will be excluded
-
range
@NotNull @NotNull SortedMap<K,V> range(@NotNull K from, boolean fromInclusive, @NotNull K to, boolean toInclusive) Returns a subset of the map between thefrom
andto
keys specified.- Parameters:
fromInclusive
- if true, the key will be included in the result, otherwise it will be excludedtoInclusive
- if true, the key will be included in the result, otherwise it will be excluded
-
comparator
Comparator<? super K> comparator()Returns the comparator associated with this map, ornull
if the default ordering is used. -
first
Returns the first entry in the map ornull
if the map is empty. -
last
Returns the last entry in the map ornull
if the map is empty. -
drop
Returns a map containing all elements in this map, excluding the firstnumber
of elements. -
take
Returns a list containing the firstnumber
of elements from this list. -
asSortedMap
Returns an immutable view of this map as an instance ofjava.util.SortedMap
.
-