Type Bounds in Scala are restrictions on type parameter or type variable. By the usage of these type bounds, we can set up limits for the variables. These bounds help to put up our code into real-world examples. We need to impose certain limitations and boundaries to every factor in real life, that is what the Type bounds do in Scala.
There are three types of types bounds supported in Scala:
Here we will discuss view bound.
View Bound is one of the type bound used in Scala. View bound is basically used where existing implicit conversions are used automatically. In some programs, to solve any problem implicit conversions are done automatically. View bound is used to take advantage of these implicit conversions.
[T <% S]
Here, T is a type parameter and S is a type. <% denotes view bound.
Below examples illustrate the concept of view bound in Scala:
- Scala | Upper bound
- Scala | Lower Bound
- Lower and Upper Bound Theory
- Scala Tutorial – Learn Scala with Step By Step Guide
- Polygraph to check View Serializabilty in DBMS
- How to place the image above the slider in mobile view in bootstrap?
- How to insert HTML into view from AngularJS controller?
- What is GAV (Global as View)?
- How to set the view-port meta tag for iPhone that handles rotation properly ?
- Scala short <(x: Short): Boolean
- Scala short <(x: Char): Boolean
- Scala Extractors
- Scala | Partially Applied functions
- Scala String indexOf(String str) method with example
- Scala String contentEquals() method with example
- Scala Keywords
- Scala Int /(x: Int) method with example
- Scala Int /(x: Short) method with example
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.