
org.analogweb.util.CollectionUtils Maven / Gradle / Ivy
The newest version!
package org.analogweb.util;
import java.util.Collection;
import java.util.List;
/**
* @author snowgoose
*/
public class CollectionUtils {
public static boolean isEmpty(Collection aCollection) {
return (aCollection == null || aCollection.isEmpty());
}
public static boolean isNotEmpty(Collection aCollection) {
return isEmpty(aCollection) == false;
}
public static T indexOf(List aCollection, int index) {
return indexOf(aCollection, index, null);
}
public static T indexOf(List aCollection, int index, T defaultValue) {
if (isEmpty(aCollection) || index < 0 || aCollection.size() <= index) {
return defaultValue;
}
return aCollection.get(index);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy