Scala Int self() method with example Last Updated : 23 Feb, 2021 Comments Improve Suggest changes Like Article Like Report The self() method is utilized to return the same value which has been specified. Method Definition: (Value).selfReturn Type: It returns true the same value which has been specified. Example 1: Scala // Scala program of Int self() // method // Creating object object GfG { // Main method def main(args:Array[String]) { // Applying self method val result = (5).self // Displays output println(result) } } Output: 5 Example 2: Scala // Scala program of Int self() // method // Creating object object GfG { // Main method def main(args:Array[String]) { // Applying self method val result = (10).self // Displays output println(result) } } Output:10 Comment More infoAdvertise with us Next Article Scala Int self() method with example K Kanchan_Ray Follow Improve Article Tags : Scala Scala Scala-Method Similar Reads Scala Set init() method with example The init() method is utilized to find all the elements of the set except the last one. Method Definition: def init: Set[A] Return Type: It returns all the elements of the set except the last one. Example #1: Scala // Scala program of init() // method // Creating object object GfG { // Main method de 1 min read Scala Float self() method with example The self() method is utilized to return the same value which has been specified. Method Definition: (Value).self Return Type: It returns the same value which has been specified. Example #1: Scala // Scala program of Float self() // method // Creating object object GfG { // Main method def main(args: 1 min read Scala Set find() method with example The find() method is utilized to find the first element of the set that satisfies the given predicate if present. Method Definition: def find(p: (A) => Boolean): Option[A] Return Type: It returns the first element of the set which satisfies the given predicate. Example #1: Scala // Scala program 1 min read Scala List size() method with example The size() method is utilized to find the number of elements in the stated list. Method Definition: def size(): Int Return Type: It returns the number of elements in the stated list. Example #1: Scala // Scala program of size() // method // Creating object object GfG { // Main method def main(args:A 1 min read Scala Set -() method with example The -() method is utilized to creates a new set with a given element removed from the set. Method Definition: def -(elem: A): Set[A] Return Type: It returns a new set with a given element removed from the set. Example #1: Scala // Scala program of -() // method // Creating object object GfG { // Mai 1 min read Like