Java Count the number of items in a List
By:Roy.LiuLast updated:2019-08-11
In Java, we can use List.size() to count the number of items in a List
package com.mkyong.example;
import java.util.Arrays;
import java.util.List;
public class JavaExample {
public static void main(String[] args) {
List<String> list = Arrays.asList("a", "b", "c");
System.out.println(list.size());
Output
References
From:一号门
Previous:Python How to convert String to int

COMMENTS