# Tag Archives: Scala-Map

The transform() method is utilized to transform the elements of the map into a mutable map. Method Definition: def transform(f: (K, V) => V): Map.this.typeâ€¦ Read More
The size() is utilized to find the number of key-value pairs in the stated map. Method Definition: def size: Int Return Type: It returns theâ€¦ Read More
In Scala the product of the map elements can be done by utilizing foldLeft method. Syntax: m1.foldLeft(1)(_*_._1) Here, m1 is used for a Map, foldLeftâ€¦ Read More
The retain() method is utilized to retain all the pairs of the map that satisfies the stated condition. Method Definition: def retain(p: (A, B) =>â€¦ Read More
In Scala, the sum of the map elements can be done by utilizing foldLeft method. Syntax : m1.foldLeft(0)(_+_._1) Here, m1 is used for a Map,â€¦ Read More
The max() method is utilized to find the largest element of the map. Method Definition: def max: (A, B) Return Type: It returns the largestâ€¦ Read More
The keys() method is utilized to give an iterator over all the keys of the map. Method Definition: def keys: Iterable[A] Return Type: It returnsâ€¦ Read More
The remove() method is utilized to remove a key from the map and return its value only. Method Definition: def remove(key: A): Option[B] Return Type:â€¦ Read More
The isEmpty() method is utilized to check if the given map is empty or not. Method Definition: def isEmpty: Boolean Return Type: It returns trueâ€¦ Read More
The foreach() method is utilized to apply the given function to all the elements of the map. Method Definition: def foreach(f: ((A, B)) => Unit):â€¦ Read More
The find() method is utilized to find the first element of the map that satisfies the given predicate. Method Definition: def find(p: ((A, B)) =>â€¦ Read More
The filterKeys() method is utilized to find all the pairs where the keys satisfies the given predicate. Method Definition: def filterKeys(p: (A) => Boolean): Map[A,â€¦ Read More
The filter() method is utilized to select all elements of the map which satisfies a stated predicate. Method Definition: def filter(p: ((A, B))=> Boolean): Map[A,â€¦ Read More
The exists() method is utilized to check if the given predicate satisfy the elements of the map or not. Method Definition: def exists(p: ((A, B))â€¦ Read More
The last() method is utilized to return the last element of the map. Method Definition: def last: (A, B) Return Type: It returns the lastâ€¦ Read More