Skip to content

Tag Archives: Scala-list

Variance is the interconnection of Sub-Typing relationships which are either of complicated types or of their constituent types. Scala provides three types of variance: Covariant… Read More
The isEmpty operation is utilized to check if the stated list is empty or not. Syntax: m1.isEmpty Here, m1 is Map name. isEmpty is method… Read More
This method is same as mkString() method but here a start, a separator and an end is also included. Method Definition: defmkString(start: String, sep: String,… Read More
The mkString() method is utilized to display all the elements of the list in a string along with a separator. Method Definition: def mkString(sep: String):… Read More
The mkString() method is utilized to display all the elements of the list in a string. Method Definition: def mkString: String Return Type: It returns… Read More
The map() method is utilized to apply the stated function to all the elements of the list. Method Definition: def map[B](f: (A) => B): List[B]… Read More
The length() method is utilized to find the length of the list. Method Definition: def length: Int Return Type: It returns the length of the… Read More
The forall() method is utilized to check if the given predicate satisfies all the elements of the list or not. Method Definition: def forall (p:… Read More
The exists() method is utilized to check if the given predicate satisfy the elements of the list or not. Method Definition: def exists(p: (A) =>… Read More
The lastIndexOf() method is utilized to find the index of the last occurrence of the element present in this method as argument. Method Definition: def… Read More
The indexOf() method is utilized to check the index of the element from the stated list present in the method as argument. Method Definition: def… Read More
The iterator method is utilized to give an iterator. Method Definition: def iterator: Iterator[A] Return Type: It returns a non-empty iterator for non-empty list and… Read More
The init() method is utilized to find all the elements of the list except the last one. Method Definition: def init: List[A] Return Type: It… Read More
In order to concatenate two lists we need to utilize concat() method in Scala. Syntax: List.concat(l1, l2) In above syntax, l1 is list1 and l2… Read More
This method is same as addString() method but here a separator is also included. Method Definition: def addString(b: StringBuilder, sep: String): StringBuilder Return Type: It… Read More