Kotlin a little too hard.

Source: Internet
Author: User

 Public Fun readbloghtml (blog:string): observable<string> {    return  Observable.just (blog                    ), assembleurl (blog)}                    , readhtml (URL)}}

I was a little confused ...

And in fact Flatmap is not needed, because Kotlin read the source of the Web page is a word ...

 Public Fun readhtml (url:string): observable<string> {    return Observable.create<string> {        - subscriber.onnext (URL). ReadText ()); Subscriber.oncompleted ()    }}

It's better not to observable ...

And so it becomes this:

 Public Fun readbloghtml (blog:string): observable<string> = observable.just (blog)                    , assembleurl (blog)}                     readhtml (URL)}private fun Assembleurl (blog:string?): String = "//$blog. tumblr.com/page/ Public Fun readhtml (url:string): String = URL (url). ReadText ()

Do you want to write this code again?

Huh?

Rxjava No More ...

can become this:

Fun Test () {    Async {        = readbloghtml ("blog")        uithread {update (HTML)    }}} public Fun readbloghtml (blog:string): String = readhtml (assembleurl (blog))private Fun Assembleurl ( Blog:string?): String = "http://$blog . tumblr.com/page/" Public Fun readhtml (url:string) string = URL (url). rea Dtext ()

Ah??

Kotlin a little too hard.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.