
org.guppy4j.Iterables Maven / Gradle / Ivy
The newest version!
package org.guppy4j;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import static org.guppy4j.Booleans.not;
/**
* Static helper methods for iterable objects
*/
public final class Iterables {
public static Stream stream(Iterable iterable) {
return StreamSupport.stream(iterable.spliterator(), false);
}
public static boolean exists(Iterable> iterable) {
return not(isNullOrEmpty(iterable));
}
public static boolean isNullOrEmpty(Iterable> iterable) {
return iterable == null || not(iterable.iterator().hasNext());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy