Size of List can be find by size() method. In size method, it will return value in integer.
Example of finding size in List in Java
List<String> ls=new ArrayList<String>();
ls.add("one");
ls.add("Three");
ls.add("two");
ls.add("four");
int sizeOfList=ls.size();
System.out.println("Size of List :"+sizeOfList);
Output
Size of List :4
Tags: Collections



Link to Us