Java Array Length Get arrayCounter(T[] x)

Here you can find the source of arrayCounter(T[] x)

Description

array Counter

License

Open Source License

Declaration

public static <T> int arrayCounter(T[] x) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static <T> int arrayCounter(T[] x) {
        int z = 0;
        for (int i = 0; i < x.length; i++) {
            T y = x[i];//from w  w  w. ja v a2  s  .c  o  m
            if (y != null) {
                z++;
            }
        }
        return z;
    }
}

Related

  1. arrayBounds(int arrayLength, int offset, int length)
  2. arrayLenght(Object array)
  3. arrayLength(Object array, int defaultIfNull, int defaultIfNotArray)
  4. arrayLength(Object o)
  5. arrayLength(Object[] ar)