This is an automated email from the ASF dual-hosted git repository.
fanningpj pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko-grpc.git
The following commit(s) were added to refs/heads/main by this push:
new b905a0b0 use groupMap (#514)
b905a0b0 is described below
commit b905a0b0439d981bdc0ad5625a9e2f240d9680fb
Author: PJ Fanning <[email protected]>
AuthorDate: Fri Sep 19 08:21:12 2025 +0100
use groupMap (#514)
---
.../org/apache/pekko/grpc/internal/MetadataImpl.scala | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
diff --git
a/runtime/src/main/scala/org/apache/pekko/grpc/internal/MetadataImpl.scala
b/runtime/src/main/scala/org/apache/pekko/grpc/internal/MetadataImpl.scala
index e20e6994..8eef1db6 100644
--- a/runtime/src/main/scala/org/apache/pekko/grpc/internal/MetadataImpl.scala
+++ b/runtime/src/main/scala/org/apache/pekko/grpc/internal/MetadataImpl.scala
@@ -42,20 +42,8 @@ import pekko.grpc.scaladsl.{ BytesEntry, Metadata,
MetadataEntry, StringEntry }
def decodeBinaryHeader(value: String): ByteString =
ByteString(value).decodeBase64
- def toMap(list: List[(String, MetadataEntry)]): Map[String,
List[MetadataEntry]] = {
- // This method is complicated by the changes to mapValues in scala 2.13.
-
- // For Scala 2.12, this should be:
- // list.groupBy(_._1).mapValues(_.map(_._2)).toMap
-
- // For scala 2.13, Map.mapValues is deprecated. The suggested migration is:
- // list.groupBy(_._1).view.mapValues(_.map(_._2)).toMap
-
- // Even better would be:
- // list.groupMap(_._1)(_._2)
-
- list.groupBy(_._1).view.mapValues(_.map(_._2)).toMap
- }
+ def toMap(list: List[(String, MetadataEntry)]): Map[String,
List[MetadataEntry]] =
+ list.groupMap(_._1)(_._2)
def niceStringRep(metadata: Map[String, List[MetadataEntry]]) = {
val data = metadata.map { case (key, values) => key + " -> " +
values.mkString("[", ", ", "]") }.mkString(", ")
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]