106
Scala ListMap
This class implements immutable maps by using a list-based data structure. It maintains insertion order and returns ListMap. This collection is suitable for small elements.
You can create empty ListMap either by calling its constructor or using ListMap.empty method.
Scala ListMap Example
In this example, we have created an empty ListMap and non-empty ListMap as well.
Output:
ListMap(Rice -> 100, Wheat -> 50, Gram -> 500) ListMap() ListMap()
Scala ListMap Example: Applying Basic Operations
Output:
Rice->100 Wheat->50 Gram->500 500 Rice -> 100 Wheat -> 50 Gram -> 500 Pulses -> 550
Next TopicScala Tuples