[mod] modified traversableToMap to have a default function
This commit is contained in:
@@ -115,7 +115,7 @@ package object convertUtil {
|
|||||||
|
|
||||||
package object mapUtil {
|
package object mapUtil {
|
||||||
|
|
||||||
def traversableToMap[A, B](traversable: Traversable[Any], getTuple: (Any) => (A, B)): Map[A, B] = {
|
def traversableToMap[A, B](traversable: Traversable[Any], getTuple: (Any) => (A, B) = (e: Any) => e.asInstanceOf[(A, B)]._1 -> e.asInstanceOf[(A, B)]._2): Map[A, B] = {
|
||||||
// Traversable[Tuple[A, B]] can be converted via .map
|
// Traversable[Tuple[A, B]] can be converted via .map
|
||||||
// .foldLeft used in favor of .map().toMap as the latter needs two traversals
|
// .foldLeft used in favor of .map().toMap as the latter needs two traversals
|
||||||
// traversable.map(e => getKey(e) -> getValue(e)).toMap
|
// traversable.map(e => getKey(e) -> getValue(e)).toMap
|
||||||
|
|||||||
Reference in New Issue
Block a user