List is a memory location where we can store multiple data.
What is Immutable List?
Immutable List in Programming Language
- Immutable List, as suggested by the name, is a type of List which is immutable. It means that the content of the List are fixed or constant after declaration, that is, they are read-only.
- If any attempt made to add, delete and update elements in the List, Unsupported Operation Exception is thrown.
- An Immutable List does not allow null element either.
- If any attempt made to create an Immutable List with null element, Null Pointer Exception is thrown. If any attempt is made to add null element in List, Unsupported Operation Exception is thrown.
Advantages of Immutable List
- They are thread safe.
- They are memory efficient.
- Since they are immutable, hence they can be passed over to third party libraries without any problem.
Note that it is an immutable collection,
TCCI Tririd Coaching Institute is a best choice for every student who wants to learn Fundamental of Programming. Our faculty have vast experience of teaching all programming Language.
Hurry up, get admission at TCCI to learn programming Language.
Call us @ 9825618292