DT Big Data Dream factory 81st Talk

Source: Internet
Author: User

DT Big Data Dream factory 81st Talk
Http://yun.baidu.com/s/1uLFye
In this section, Mr. Wang speaks of the inverse of list, covariance, the Nether.
Abstaract class Big_data
Class Hadoop extends big_data//one type
Class Spark extends big_data//another type
Object List_constructor _internals{
def main (args:array[string]) {
Val hadoop=new hadoop::nil//a list of Hadoop
Val big_data=new spark::hadoop//A list of both Hadoop and Spark,
This is because Hadoop can append spark because:: The parameter of the method is the contravariant point,
If you follow the normal upper bound, if Hadoop is a subclass of Big_data,
Then List[hadoop] should be the parent class of List[big_data]
But in fact we expect list[big_data] to be the parent of List[hadoop] (covariant)
So let him exist in the Nether [b>:a] rather than [a<:b], as we wish.
}
}

DT Big Data Dream factory 81st Talk

Related Article

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.