The take() method belongs to the value member of the class List. It is utilized to take the first n elements from the list.
Method Definition: deftake(n: Int): List[A]
Where, n is the number of elements to be taken from the list.
Return Type:It returns a list containing only the first n elements from the stated list or returns the whole list if n is more than the number of elements in the given list.
List(1, 2, 3, 4)
List(a, b, c, d)