1

Let me say that I have a single string concatenated uris.

http://...[sp]http://...[sp]http://...

I'm trying to convert each split string to URIs.

Stream.of(string.split("\\s")).map(uri -> URI::new);

Compiler complains.

Cannot infer type-variable(s) R

What did I do wrong?

Tagir Valeev
  • 97,161
  • 19
  • 222
  • 334
Jin Kwon
  • 20,295
  • 14
  • 115
  • 184
  • 1
    A guess: URI has several constructors, all of which take only String parameters. All those ctor patterns match your input of a stream of Strings, so it can't choose which one. – markspace Dec 23 '14 at 04:14
  • @markspace Confirmed. I don't understand what the constructor with a single String is not chosen. – Jin Kwon Dec 23 '14 at 04:19

1 Answers1

1
Stream.of(s.split("//s")).map(URI::new);

click here for an example

Community
  • 1
  • 1
Ramesh-X
  • 4,853
  • 6
  • 46
  • 67