List of usage examples for java.util Set isEmpty
boolean isEmpty();
From source file:org.joinfaces.annotations.JsfCdiToSpring.java
static String deduceScopeName(Set<String> annotationTypes) { String result = null;/* w w w . ja v a2 s .c o m*/ if (annotationTypes != null && !annotationTypes.isEmpty()) { if (annotationTypes.contains(javax.enterprise.context.RequestScoped.class.getName()) || annotationTypes.contains(javax.faces.bean.RequestScoped.class.getName())) { result = REQUEST; } else if (annotationTypes.contains(javax.enterprise.context.SessionScoped.class.getName()) || annotationTypes.contains(javax.faces.bean.SessionScoped.class.getName())) { result = SESSION; } else if (annotationTypes.contains(javax.enterprise.context.ApplicationScoped.class.getName()) || annotationTypes.contains(javax.faces.bean.ApplicationScoped.class.getName())) { result = SINGLETON; } else if (annotationTypes.contains(javax.faces.bean.NoneScoped.class.getName())) { result = PROTOTYPE; } else if (annotationTypes.contains(javax.faces.view.ViewScoped.class.getName()) || annotationTypes.contains(javax.faces.bean.ViewScoped.class.getName())) { result = VIEW; } else if (annotationTypes.contains(javax.enterprise.context.ConversationScoped.class.getName())) { result = SESSION; } } return result; }
From source file:com.thoughtworks.go.server.domain.user.FilterValidator.java
private static void validateState(Set<String> state) { if (state == null) throw new FilterValidationException("Filter state should never be NULL"); if (!state.isEmpty() && !VALID_STATES.containsAll(state)) throw new FilterValidationException(MSG_INVALID_STATES); }
From source file:gemlite.core.internal.admin.AdminUtil.java
/** * ?RegionNames,Set<String>/* w w w .ja v a 2 s . co m*/ * * @param cache * @return */ public static TreeSet<String> getRegionNames(Cache cache) { try { Set<Region<?, ?>> regions = cache.rootRegions(); if ((regions.isEmpty()) || (regions == null)) { return null; } else { TreeSet regionInformationSet = new TreeSet(); for (Region region : regions) { regionInformationSet.add(region.getFullPath().substring(1)); } return regionInformationSet; } } catch (CacheClosedException e) { LogUtil.getAppLog().error("error CacheClosedException:", e); } catch (Exception e) { LogUtil.getAppLog().error("error:", e); } return null; }
From source file:com.glaf.core.util.AnnotationUtils.java
public static Collection<String> findClasses(String name) { AnnotationDB db = getAnnotationDB(); Map<String, Set<String>> annotationIndex = db.getAnnotationIndex(); Set<String> entities = annotationIndex.get(name); Collection<String> sortSet = new TreeSet<String>(); if (entities != null && !entities.isEmpty()) { for (String str : entities) { sortSet.add(str);//from www. j a v a2 s.c o m } } return sortSet; }
From source file:se.uu.it.cs.recsys.ruleminer.api.RuleMiner.java
private static boolean hasIntersection(Set<Integer> a, Set<Integer> b) { Set<Integer> aClone = new HashSet<>(a); Set<Integer> bClone = new HashSet<>(b); aClone.retainAll(bClone);/*from w w w .j a v a 2s .c o m*/ return !aClone.isEmpty(); }
From source file:com.premiumminds.billy.core.util.BillyValidator.java
public static void validateBeans(Object... objects) throws ValidationException { StringBuilder builder = new StringBuilder(); boolean valid = true; for (Object o : objects) { Set<ConstraintViolation<Object>> violations = BillyValidator.instance.validator.validate(o); if (!violations.isEmpty()) { valid = false;// w w w.j av a 2 s.c o m builder.append("There was an exception while validating instance of "); builder.append(o.getClass().getCanonicalName()); builder.append('\n'); for (ConstraintViolation<Object> v : violations) { builder.append('\n'); builder.append(v.getPropertyPath() + " - " + v.getMessage()); } } } if (!valid) { throw new ValidationException(builder.toString()); } }
From source file:Main.java
@SafeVarargs public static boolean equalsSize(List<? extends Object>... lists) { Set<Integer> sizes = new HashSet<Integer>(lists.length); for (List<? extends Object> list : lists) { if (list == null) { return false; }//from w w w . ja v a2s . c om if (sizes.isEmpty()) { sizes.add(list.size()); } else { if (sizes.add(list.size())) { return false; } } } return true; }
From source file:com.mirth.connect.util.ChannelDependencyUtil.java
/** * Given a set of channel IDs and a dependency graph, this method splits the IDs into a set of * unordered IDs (that have no dependents or dependencies), and a list of multiple sets of * ordered IDs. The list is ordered such that the IDs in any given set are not interdependent on * each other, but all the IDs in the set are individually dependent on one or more IDs in one * of the subsequent sets.//from w w w . j a va 2 s.co m */ public static OrderedChannels getOrderedChannels(Set<String> channelIds, ChannelDependencyGraph graph) { Set<String> unorderedIds = new HashSet<String>(channelIds); List<Set<String>> orderedIds = new ArrayList<Set<String>>(); for (Set<String> set : graph.getOrderedElements()) { // Only include IDs in the set passed in set.retainAll(channelIds); if (!set.isEmpty()) { orderedIds.add(set); unorderedIds.removeAll(set); } } return new OrderedChannels(unorderedIds, orderedIds); }
From source file:it.geosolutions.geostore.services.rest.auditing.AuditInfoExtractor.java
private static String groupsToString(Set<UserGroup> groups) { if (groups.isEmpty()) { return null; }//from ww w . j a va 2 s . c o m StringBuilder groupsString = new StringBuilder(); for (UserGroup userGroup : groups) { groupsString.append(userGroup.getGroupName()).append(","); } groupsString.deleteCharAt(groupsString.length() - 1); return groupsString.toString(); }
From source file:org.cloudfoundry.reconfiguration.play.Configurer.java
static void configure(ApplicationConfiguration applicationConfiguration, Cloud cloud, PropertySetter propertySetter) { propertySetter.setCloudProperties(); Set<String> databaseNames = applicationConfiguration.getDatabaseNames(); propertySetter.setDatabaseProperties(databaseNames); if (databaseNames.isEmpty()) { LOGGER.info("No databases found. Skipping auto-reconfiguration."); } else if (databaseNames.size() > 1) { LOGGER.warning(String.format("Multiple (%d) databases found. Skipping auto-reconfiguration.", databaseNames.size()));//from w ww. ja v a 2s .co m } else { processDatabase(applicationConfiguration, cloud, databaseNames.iterator().next()); } }