List of usage examples for java.util Collection isEmpty
boolean isEmpty();
From source file:com.agileEAP.ireport.utils.Collections3.java
/** * ?./*from w w w. j a v a 2s . c om*/ */ public static boolean isNotEmpty(Collection collection) { return (collection != null && !(collection.isEmpty())); }
From source file:com.qwazr.QwazrConfiguration.java
private static Set<String> buildGroups(Collection<String> groupCollection) { if (groupCollection == null || groupCollection.isEmpty()) return null; Set<String> groups = new HashSet<>(); groupCollection.forEach((g) -> groups.add(g.trim())); return groups; }
From source file:apm.common.utils.Collections3.java
/** * ?.//from ww w .j a v a2 s.c o m */ public static boolean isNotEmpty(Collection collection) { return ((collection != null) && !(collection.isEmpty())); }
From source file:eionet.cr.util.FormatUtils.java
/** * Returns object values for the given predicate in given langauges. * * @param predicateUri predicate URI/*from ww w . jav a 2 s . c om*/ * @param subjectDTO SubjectDTO data object for subject * @param languages Set<String> language codes * @return String */ public static String getObjectValuesForPredicate(String predicateUri, SubjectDTO subjectDTO, List<String> languages) { String result = ""; if (subjectDTO.getPredicateCount() > 0) { Collection<ObjectDTO> objects = subjectDTO.getObjects(predicateUri); if (objects != null && !objects.isEmpty()) { LinkedHashSet<ObjectDTO> distinctObjects = new LinkedHashSet<ObjectDTO>(objects); StringBuffer bufLiterals = new StringBuffer(); StringBuffer bufNonLiterals = new StringBuffer(); String resultFromHitSource = null; for (ObjectDTO objectDTO : distinctObjects) { String objectString = objectDTO.getValue().trim(); // if the source of the object matches the search-hit source of the subject then // remember the object value and break if (subjectDTO.getHitSource() > 0 && objectDTO.getSourceHashSmart() == subjectDTO.getHitSource() && !StringUtils.isBlank(objectString) && objectDTO.isLiteral()) { resultFromHitSource = objectString; break; } if (objectString.length() > 0) { if (objectDTO.isLiteral()) { if (languages.isEmpty() || languages.contains(objectDTO.getLanguage())) { bufLiterals.append(bufLiterals.length() > 0 ? ", " : "").append(objectString); } } else { bufNonLiterals.append(bufNonLiterals.length() > 0 ? ", " : "").append(objectString); } } } // if there was a value found that came from search-hit source then prefer that one as the result if (!StringUtils.isBlank(resultFromHitSource)) { result = resultFromHitSource; } else { result = bufLiterals.length() > 0 ? bufLiterals.toString() : bufNonLiterals.toString(); } } } return result; }
From source file:de.metas.ui.web.window.datatypes.json.filters.JSONDocumentFilterDescriptor.java
public static List<JSONDocumentFilterDescriptor> ofCollection( @Nullable final Collection<DocumentFilterDescriptor> filters, final JSONOptions jsonOpts) { if (filters == null || filters.isEmpty()) { return ImmutableList.of(); }//from ww w. j a v a2 s .c om return filters.stream().map(filter -> new JSONDocumentFilterDescriptor(filter, jsonOpts)) .collect(GuavaCollectors.toImmutableList()); }
From source file:io.fabric8.kubernetes.api.ParseExamplesTest.java
public static void assertNotEmpty(String name, Collection collection) { assertNotNull(name + " is null!", collection); assertFalse(name + " should not be empty!", collection.isEmpty()); }
From source file:$.Collections3.java
/** * ?.// ww w .ja va 2s . co m */ public static boolean isEmpty(Collection collection) { return (collection == null) || collection.isEmpty(); }
From source file:$.Collections3.java
/** * ?./*from www . j ava 2 s. com*/ */ public static boolean isNotEmpty(Collection collection) { return (collection != null) && !(collection.isEmpty()); }
From source file:cn.com.axiom.utils.Collections3.java
/** * ?.//from ww w . ja v a 2 s .com */ @SuppressWarnings("rawtypes") public static boolean isNotEmpty(Collection collection) { return (collection != null && !(collection.isEmpty())); }
From source file:com.intuit.tank.search.util.SearchUtils.java
/** * returns a sort or null if no sort is specified. * /* www . jav a 2 s . c o m*/ * @param searchQuery * the query containing the sorts * @return the lucene sort or null if no sort is specified */ public static final Sort createLuceneSort(SearchQuery searchQuery) { Sort ret = null; Collection<SortOrder> sorts = searchQuery.getSortOrder(); if (!sorts.isEmpty()) { SortField[] array = new SortField[sorts.size()]; int i = 0; for (SortOrder sortOrder : sorts) { array[i] = new SortField(sortOrder.getField(), SortField.STRING, sortOrder.isDescending()); } ret = new Sort(array); } return ret; }