List of usage examples for java.util Collection isEmpty
boolean isEmpty();
From source file:com.qwazr.QwazrConfiguration.java
private static FileFilter buildEtcFileFilter(Collection<String> etcs) { if (etcs == null || etcs.isEmpty()) return FileFileFilter.FILE; return new AndFileFilter(FileFileFilter.FILE, new WildcardFileFilter(etcs.toArray(new String[etcs.size()]))); }
From source file:net.sourceforge.fenixedu.domain.reimbursementGuide.ReimbursementGuide.java
public static Integer generateReimbursementGuideNumber() { Collection<ReimbursementGuide> reimbursementGuides = Bennu.getInstance().getReimbursementGuidesSet(); return (reimbursementGuides.isEmpty()) ? Integer.valueOf(1) : Collections.max(reimbursementGuides, NUMBER_COMPARATOR).getNumber() + 1; }
From source file:ips1ap101.lib.base.util.ColUtils.java
public static <T extends Comparable<? super T>> Collection<T> sort(Collection<T> collection) { if (collection instanceof List && !collection.isEmpty()) { List<T> list = (List<T>) collection; // Collections.sort(list); wolfgangFahlSort(list);/*from www . j av a 2 s .c o m*/ } return collection; }
From source file:de.tu_berlin.dima.oligos.db.DbUtils.java
/** * Collect columns for given schema, (table(s) (and column(s))) * /*from ww w .ja va 2 s . c o m*/ * @param sparseSchema * @param connector * @param metaConnector * @return DenseSchema object - set of columns * @throws SQLException */ public static DenseSchema populateSchema(SparseSchema sparseSchema, JdbcConnector connector, MetaConnector metaConnector) throws SQLException { DenseSchema denseSchema = new DenseSchema(); for (String schema : sparseSchema.schemas()) { if (connector.checkSchema(schema)) { // Get the tables from the schema Collection<String> tables = sparseSchema.tablesIn(schema); if (tables.isEmpty()) { tables = connector.getTables(schema); } for (String table : tables) { if (connector.checkTable(schema, table)) { // Get the columns from the schema Collection<String> columns = sparseSchema.columnsIn(schema, table); if (columns.isEmpty()) { columns = connector.getColumns(schema, table); } for (String column : columns) { if (connector.checkColumn(schema, table, column)) { if (metaConnector.hasStatistics(schema, table, column)) { denseSchema.addColumn(new ColumnId(schema, table, column)); } else { Logger logger = Logger.getLogger(DbUtils.class); logger.warn( "No statistics available for " + schema + "." + table + "." + column); } } else { LOGGER.error("column does not exist for given schema and table"); System.exit(-1); } } } else { LOGGER.error("table does not exist for given schema"); System.exit(-1); } } } else { LOGGER.error("schema does not exist"); System.exit(-1); } } return denseSchema; }
From source file:net.sourceforge.fenixedu.applicationTier.Servico.teacher.RemoveProfessorshipWithPerson.java
@Atomic public static Boolean run(Person person, ExecutionCourse executionCourse) throws NotAuthorizedException { AbstractModifyProfessorshipWithPerson.run(person); Professorship professorshipToDelete = person.getProfessorshipByExecutionCourse(executionCourse); Collection shiftProfessorshipList = professorshipToDelete.getAssociatedShiftProfessorshipSet(); boolean hasCredits = false; if (!shiftProfessorshipList.isEmpty()) { hasCredits = CollectionUtils.exists(shiftProfessorshipList, new Predicate() { @Override/*from w w w . java2 s. co m*/ public boolean evaluate(Object arg0) { ShiftProfessorship shiftProfessorship = (ShiftProfessorship) arg0; return shiftProfessorship.getPercentage() != null && shiftProfessorship.getPercentage() != 0; } }); } if (!hasCredits) { professorshipToDelete.delete(); } else { if (hasCredits) { throw new DomainException("error.remove.professorship"); } } return Boolean.TRUE; }
From source file:Main.java
/** * Transforms a collection of Integers into a comma delimited String. If the * given collection of elements are null or is empty, an empty String is * returned./*from ww w. ja va2s.c o m*/ * * @param elements the collection of Integers * @return a comma delimited String. */ public static String getCommaDelimitedString(Collection<?> elements) { final StringBuilder builder = new StringBuilder(); if (elements != null && !elements.isEmpty()) { for (Object element : elements) { builder.append(element.toString()).append(DELIMITER); } return builder.substring(0, builder.length() - DELIMITER.length()); } return builder.toString(); }
From source file:Main.java
@SuppressWarnings("unchecked") public static <E> E[] toArray(Collection<?> collection, Class<E> elementType, boolean sort) { if (collection == null || collection.isEmpty()) return null; ArrayList arraylist = new ArrayList(collection); if (sort) {//w w w .j a v a 2 s .c o m Collections.sort(arraylist); } E[] array = (E[]) Array.newInstance(elementType, arraylist.size()); arraylist.toArray(array); return array; }
From source file:com.ewcms.common.lang.EmptyUtil.java
/** * ?/*from w ww.j a va2 s. c om*/ * * @param value * @return */ public static boolean isCollectionEmpty(Collection<?> value) { if (isNull(value)) { return true; } return value.isEmpty(); }
From source file:cn.taqu.core.modules.utils.Collections3.java
/** * ?./*from w w w . j a v a2 s . c o m*/ */ public static boolean isEmpty(Collection collection) { return ((collection == null) || collection.isEmpty()); }
From source file:io.github.lxgaming.teleportbow.util.Toolbox.java
public static boolean containsIgnoreCase(Collection<String> list, String targetString) { if (list == null || list.isEmpty()) { return false; }// www . ja va 2s . com for (String string : list) { if (StringUtils.equalsIgnoreCase(string, targetString)) { return true; } } return false; }