Java Utililty Methods List Size

List of utility methods to do List Size

Description

The list of methods to do List Size are organized into topic(s).

Method

intgetSize(List list)
get Size
if (isEmpty(list)) {
    return 0;
return list.size();
StringgetSize(List list)
get Size
return (String) (list != null ? list.size() : "0");
double[]getSize(List positions)
get Size
if (positions.size() > 0) {
    int[] min = getExtremeCoords(positions, true);
    int[] max = getExtremeCoords(positions, false);
    double[] result = new double[min.length];
    for (int i = 0; i < min.length; i++) {
        result[i] = (float) (max[i] - min[i] + 1) * 0.5f;
    return result;
...
intgetSize(List sourceList)
get size of list
 getSize(null)   =   0; getSize({})     =   0; getSize({1})    =   1; 
return sourceList == null ? 0 : sourceList.size();
intgetSize(List sourceList)
get Size
return sourceList == null ? 0 : sourceList.size();
intsize(List list)
size
if (list == null) {
    return 0;
return list.size();
intsize(Object[] list)
size
if (list == null) {
    return 0;
} else {
    return list.length;
intsizeNotNull(final List list)
size Not Null
int count = 0;
for (E e : list) {
    if (e != null) {
        count++;
return count;
IntegersizeOf(List l)
This function always returns the size of a list; no matter if it is null, 0 or >0.
return l != null ? l.size() : 0;
intsizeOfListMap(Map> map)
Get the total number of elements in a map whose values are lists of elements.
int result = 0;
for (Map.Entry<T, List<U>> entry : map.entrySet())
    result += entry.getValue().size();
return result;