Post

KotlinKotlin

A
Anusha V

Posted on 27th February 2024|45 views

0
votes

Kotlin Arraylist

What are the different constructors of ArrayList?

Answers
P
Sowjanya Kodiganti

Posted on 27th February 2024

There are three different types of constructors of ArrayList in kotlin they are:

Constructor  

Description 

ArrayList(capacity : Int)

We can create the ArrayList of our required capacity by using this constructor.  

ArrayList<E>()

By using this constructor, we can create an empty list.

ArrayList(elements : Collection<E>) 

By using this constructor, we can create an ArrayList filled by the elements of the collection.

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo
  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos