Re: Sammy + wildcards + type inference = :(

Stephen Compall <[email protected]>
Newsgroups gmane.comp.lang.scala
Message-ID <[email protected]>
On Fri, 2015-06-26 at 18:05 -0700, Roman Janusz wrote:
> Is there any chance this will work?
> 
> 
> $ scala -Xexperimental
> Welcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM,
> Java 1.8.0_40).
> Type in expressions to have them evaluated.
> Type :help for more information.
> 
> scala> new java.util.ArrayList[String]().stream.map(_.toInt)
> <console>:8: error: no type parameters for method map: (x$1:
> java.util.function.Function[_ >: String, _ <:
> R])java.util.stream.Stream[R] exist so that it can be applied to
> arguments (java.util.function.Function[String,Int] with Serializable)
>  --- because ---
> argument expression's type is not compatible with formal parameter
> type;
>  found   : java.util.function.Function[String,Int] with Serializable
>  required: java.util.function.Function[_ >: String, _ <: ?R]


Not fatal, I would say.


Welcome to Scala version 2.11.7 (OpenJDK 64-Bit Server VM, Java 1.8.0_45).
Type in expressions to have them evaluated.
Type :help for more information.

scala> import java.util.ArrayList, java.util.stream.{Stream => JStream}
import java.util.ArrayList
import java.util.stream.{Stream=>JStream}

scala> new java.util.ArrayList[String]().stream.map[Int](_.toInt)
res1: java.util.stream.Stream[Int] = java.util.stream.ReferencePipeline$3@5b49c202

scala> new java.util.ArrayList[String]().stream.map(_.toInt): JStream[Int]
res2: java.util.stream.Stream[Int] = java.util.stream.ReferencePipeline$3@47bded3c


Not ideal, but maybe something else is going on here.

-- 
Stephen Compall
"^aCollection allSatisfy: [:each|aCondition]": less is better

-- 
You received this message because you are subscribed to the Google Groups "scala-language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
signature.asc (application/pgp-signature, 181 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEABECAAYFAlWN/mUACgkQYWjD35Pp0wKzBACgvZLQSxJQw9jPj14AMb8tR8PL
BNAAoIPzGYkwODbMoRzX/oDcQnySKX1X
=3f2u
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.