Reputation: 2239
I heard someone said:
"Scala uses a type lattice rather than a type hierarchy, which is different from Java".
I do not quite understand what the meaning type lattice is and what the main difference between type lattice and type hierarchy is.
Could someone explain this term to me?
Upvotes: 7
Views: 1408
Reputation: 9413
Its essentially means that : The type hierarchy for Scala is a lattice, i.e. it has a “bottom” as well as a “top”.
As seen from the image the top type here is Any
and the bottom is Nothing
.
Upvotes: 9