Arraylist in Explained With IndianPremierLeague
Java ArrayList is a part of the Java collections framework and it is a class of java.util package. It provides us with dynamic arrays in…
Arraylist in Explained With IndianPremierLeague
Java ArrayList is a part of the Java collections framework and it is a class of java.util package. It provides us with dynamic arrays in Java. Though, it may be slower than standard arrays but can be helpful in programs where lots of manipulation in the array is needed. This class is found in java.util package. The main advantage of ArrayList in Java is, that if we declare an array then we need to mention the size, but in ArrayList, it is not needed to mention the size of ArrayList. If you want to mention the size then you can do it
so lets get started by explaining Arraylist through a example program:
import java.util.ArrayList;
public class IndianPremierLeague {
public static void main(String []args){
ArrayList<String>Teams=new ArrayList<>();
Teams.add("Mumbai Indians");
Teams.add("Chennai Super Kings");
Teams.add("Royal challengers Bangalore ");
Teams.add("Gujarat Titans ");
Teams.add("Kings eleven Punjab");
System.out.println(Teams);
System.out.println(Teams.size()+" There are 5 Teams available in the list");
}
}
Java program illustrates a simple scenario related to the Indian Premier League (IPL), a popular professional Twenty20 cricket league in India. Let’s dissect the code and understand the concepts it employs.
1.Class Definition: IndianPremierLeague-
The program begins with the definition of a class named IndianPremierLeague.In Java, a class serves as a blueprint for creating objects.
2. main() Method -
The main() method is the entry point of the program. It’s where the execution starts when the program is run. Here, the main() method initializes an ArrayList and populates it with the names of IPL teams.
3. ArrayList Initialization -
ArrayList is a part of the Java Collections Framework and provides dynamic array-like functionality.
4. Adding Teams to the ArrayList -
Teams participating in the IPL are added to the ArrayList using the add() method. Each team name is a string enclosed within double quotes.
5. Printing the ArrayList -
This statement prints the entire ArrayList, displaying all the teams added to it.
6. Retrieving the Size of the ArrayList -
System.out.println(Teams.size() + “ There are 5 Teams available in the list”); The size() method returns the number of elements (teams) in the ArrayList. This count is then printed along with a message indicating the number of teams available.
Output:

Thus the Program gives an idea about how Arraylist works and what is an Arraylist.
Credits:
Here by i would like to thank my Mentor muthukumaran navaneethakrishnan, https://github.com/muthuishere
who has been mentoring me in this journey with the java.
Sources to refer:
메타데이터
- post_id
- 6a4f8bd1f6f2
- slug
- arraylist-in-explained-with-indianpremierleague-6a4f8bd1f6f2
- url
- https://medium.com/@yogeshjayashankar17/arraylist-in-explained-with-indianpremierleague-6a4f8bd1f6f2
- canonical_url
- https://medium.com/@yogeshjayashankar17/arraylist-in-explained-with-indianpremierleague-6a4f8bd1f6f2
- author_url
- https://medium.com/@yogeshjayashankar17
- status
- ok
- fetched_at
- 2026-06-28 04:42:08