Check if Collection has the Size - Android java.util

Android examples for java.util:Collection Size

Description

Check if Collection has the Size

Demo Code


//package com.java2s;
import java.util.Collection;

public class Main {
    public static boolean hasSize(Collection<? extends Object> source,
            int expectedSize) {
        if (source == null) {
            return false;
        }/*from w  ww .  j a  v a2  s  .  c  o m*/
        return source.size() == expectedSize;
    }
}

Related Tutorials