[
https://issues.apache.org/jira/browse/FLINK-6658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16021172#comment-16021172
]
ASF GitHub Bot commented on FLINK-6658:
---------------------------------------
Github user kl0u commented on a diff in the pull request:
https://github.com/apache/flink/pull/3963#discussion_r117985885
--- Diff:
flink-libraries/flink-cep-scala/src/main/scala/org/apache/flink/cep/scala/package.scala
---
@@ -40,7 +44,11 @@ package object scala {
private[flink] def cleanClosure[F <: AnyRef](f: F, checkSerializable:
Boolean = true): F = {
ClosureCleaner.clean(f, checkSerializable)
- return f
+ f
+ }
+
+ private[flink] def mapToScala[T](map: JMap[String, JList[T]]):
Map[String, Iterable[T]] = {
+ map.asScala.mapValues(_.asScala.toIterable).toMap
--- End diff --
Why not getting rid of the last `.toMap` and return a `collection.Map`?
This will avoid an iteration over the elements of the `JMap` which is important
given that this method will be invoked at every incoming element. From the
rest, I think we are ok as the `asScala`s are just wrappers and the
`.mapValues` are lazily evaluated.
> Use scala Collections in scala CEP API
> --------------------------------------
>
> Key: FLINK-6658
> URL: https://issues.apache.org/jira/browse/FLINK-6658
> Project: Flink
> Issue Type: Bug
> Components: CEP
> Affects Versions: 1.3.0
> Reporter: Dawid Wysakowicz
> Assignee: Dawid Wysakowicz
>
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)