VOOZH about

URL: https://www.geeksforgeeks.org/scala/scala-set-takeright-method-with-example/

⇱ Scala Set takeRight() method with example - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Scala Set takeRight() method with example

Last Updated : 18 Oct, 2019
The takeRight() method is utilized to return a set consisting of last 'n' elements of the set.
Method Definition: def takeRight(n: Int):Set[A] Where 'n' is specifies the number of elements to select. Return Type: It returns a set consisting of last 'n' elements of the set.
Example #1:
Output:
Set(1, 2, 3, 4)
Example #2:
Output:
Set(12, 23, 43)
Comment

Explore