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

io.sentry.core.util.CollectionUtils Maven / Gradle / Ivy

There is a newer version: 3.0.0-alpha.1
Show newest version
package io.sentry.core.util;

import java.util.Collection;
import org.jetbrains.annotations.ApiStatus;

/** Util class for Collections */
@ApiStatus.Internal
public final class CollectionUtils {

  private CollectionUtils() {}

  /**
   * Returns an Iterator size
   *
   * @param data the Iterable
   * @return iterator size
   */
  public static int size(Iterable data) {
    if (data instanceof Collection) {
      return ((Collection) data).size();
    }
    int counter = 0;
    for (Object ignored : data) {
      counter++;
    }
    return counter;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy