All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.netflix.archaius.util.Iterables Maven / Gradle / Ivy

There is a newer version: 2.8.3
Show newest version
package com.netflix.archaius.util;

import com.netflix.archaius.Internal;

import java.util.Collection;

@Internal
public final class Iterables {
    private Iterables() {}

    /**
     * Returns the number of elements in {@code iterable}.
     */
    public static int size(Iterable iterable) {
        if (iterable instanceof Collection) {
            return ((Collection) iterable).size();
        }
        int size = 0;
        for (Object ignored : iterable) {
            size++;
        }
        return size;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy