How to map strings to URIs?

2019-07-29 05:44发布

问题:

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?

回答1:

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

click here for an example