Example usage for java.util Collections emptySet

List of usage examples for java.util Collections emptySet

Introduction

In this page you can find the example usage for java.util Collections emptySet.

Prototype

@SuppressWarnings("unchecked")
public static final <T> Set<T> emptySet() 

Source Link

Document

Returns an empty set (immutable).

Usage

From source file:admin.jmx.BatchMBeanExporter.java

private void registerSteps() {
    if (!registerSteps) {
        return;//w  w w .  ja  v  a  2s  . c  o m
    }
    for (String jobName : jobService.listJobs(0, Integer.MAX_VALUE)) {
        Collection<JobExecution> jobExecutions = Collections.emptySet();
        try {
            jobExecutions = jobService.listJobExecutionsForJob(jobName, 0, 1);
        } catch (NoSuchJobException e) {
            // do-nothing
            logger.error("Job listed but does not exist", e);
        }
        for (JobExecution jobExecution : jobExecutions) {
            for (StepExecution stepExecution : jobExecution.getStepExecutions()) {
                String stepName = stepExecution.getStepName();
                String stepKey = String.format("%s/%s", jobName, stepName);
                String beanKey = getBeanKeyForStepExecution(jobName, stepName);
                if (!stepKeys.contains(stepKey)) {
                    stepKeys.add(stepKey);
                    logger.info("Registering step execution " + stepKey);
                    registerBeanNameOrInstance(
                            stepExecutionMetricsFactory.createMetricsForStep(jobName, stepName), beanKey);
                }
            }
        }
    }
}

From source file:com.github.jknack.handlebars.context.MemberValueResolver.java

@Override
public Set<Entry<String, Object>> propertySet(final Object context) {
    notNull(context, "The context is required.");
    if (context instanceof Map) {
        return Collections.emptySet();
    } else if (context instanceof Collection) {
        return Collections.emptySet();
    }/*from   ww w.  j  a  va2s  .  c  o  m*/
    Set<M> members = membersFromCache(context.getClass());
    Map<String, Object> propertySet = new LinkedHashMap<String, Object>();
    for (M member : members) {
        String name = memberName(member);
        propertySet.put(name, resolve(context, name));
    }
    return propertySet.entrySet();
}

From source file:com.mingo.parser.xml.dom.QuerySetParser.java

private void parseQueryFragments(Element root, QuerySet querySet) {
    Set<QueryFragment> queryFragments = Collections.emptySet();
    NodeList fragmentNodeList = root.getElementsByTagName(QUERY_FRAGMENT);
    if (isNotEmpty(fragmentNodeList)) {
        queryFragments = Sets.newHashSet();
        for (int i = 0; i < fragmentNodeList.getLength(); i++) {
            queryFragments.add(parseQueryFragment(fragmentNodeList.item(i)));
        }/*  w w  w .j a v a  2 s  .  c o  m*/
    }
    querySet.setQueryFragments(queryFragments);
}

From source file:se.uu.it.cs.recsys.service.resource.impl.RecommendationGenerator.java

private Set<Integer> getInterestCourseIdFromDomainIds() {

    Set<String> interestedDomainIdSet = this.userPref.getInterestedComputingDomainCollection();

    if (interestedDomainIdSet == null || interestedDomainIdSet.isEmpty()) {
        return Collections.emptySet();
    }/*from   w  w w  .  j a v a 2s.c om*/

    LOGGER.debug("Interested domain id set {}", interestedDomainIdSet);

    Set<String> totalInterestedDomaindIdSet = new HashSet<>(interestedDomainIdSet);

    interestedDomainIdSet.forEach(domainId -> {
        try {
            Set<String> subDomains = this.computingDomainReasoner.getNarrowerDomainIds(domainId);

            if (!subDomains.isEmpty()) {
                totalInterestedDomaindIdSet.addAll(subDomains);
            }

            Set<String> relatedDomains = this.computingDomainReasoner.getRelatedDomainIds(domainId);

            if (!relatedDomains.isEmpty()) {
                totalInterestedDomaindIdSet.addAll(relatedDomains);
            }

        } catch (IOException ex) {
            LOGGER.error("Failed on domain reasoning for domain id {}", domainId, ex);
        }
    });

    Set<Integer> interestedCourseIdCollection = new HashSet<>();

    totalInterestedDomaindIdSet.forEach(domainId -> {
        Set<CourseDomainRelevance> relevance = this.courseDomainRelevanceRepository.findByDomainId(domainId);

        relevance.forEach(entityRel -> {
            Integer courseId = entityRel.getCourseDomainRelevancePK().getCourseId();
            interestedCourseIdCollection.add(courseId);
        });
    });

    LOGGER.debug("Interested course id generated from computing domain id set {}",
            interestedCourseIdCollection);

    return interestedCourseIdCollection;
}

From source file:io.wcm.caconfig.extensions.contextpath.impl.AbsoluteParentContextPathStrategy.java

@Activate
void activate(Config config) {
    levels = new TreeSet<>();
    if (config.levels() != null) {
        for (int level : config.levels()) {
            levels.add(level);//from w w w . ja  v a  2  s .co  m
            if (level >= unlimitedLevelStart) {
                unlimitedLevelStart = level + 1;
            }
        }
    }
    unlimited = config.unlimited();
    try {
        contextPathRegex = Pattern.compile(config.contextPathRegex());
    } catch (PatternSyntaxException ex) {
        log.warn("Invalid context path regex: " + config.contextPathRegex(), ex);
    }
    if (StringUtils.isNotEmpty(config.contextPathBlacklistRegex())) {
        try {
            contextPathBlacklistRegex = Pattern.compile(config.contextPathBlacklistRegex());
        } catch (PatternSyntaxException ex) {
            log.warn("Invalid context path blacklist regex: " + config.contextPathBlacklistRegex(), ex);
        }
    }
    configPathPatterns = config.configPathPatterns();
    serviceRanking = config.service_ranking();
    // make sure this is never null (only DS 1.4 initializes them always to empty arrays)
    templatePathsBlacklist = config.templatePathsBlacklist() != null
            ? new HashSet<>(Arrays.asList(config.templatePathsBlacklist()))
            : Collections.emptySet();
}

From source file:com.espertech.esper.epl.join.table.PropertySortedEventTable.java

public Set<EventBean> lookupRangeInverted(Object keyStart, boolean includeStart, Object keyEnd,
        boolean includeEnd) {
    if (keyStart == null || keyEnd == null) {
        return Collections.emptySet();
    }/*ww  w . ja v a  2s. c  o m*/
    keyStart = coerce(keyStart);
    keyEnd = coerce(keyEnd);
    SortedMap<Object, Set<EventBean>> submapOne = propertyIndex.headMap(keyStart, !includeStart);
    SortedMap<Object, Set<EventBean>> submapTwo = propertyIndex.tailMap(keyEnd, !includeEnd);
    return normalize(submapOne, submapTwo);
}

From source file:io.pivotal.cla.service.ClaService.java

public Set<String> findAssociatedClaNames(String repoId) {
    AccessToken accessToken = accessTokenRepository.findOne(repoId);

    if (accessToken == null) {
        return Collections.emptySet();
    }//from   www .j av  a2 s.c  o  m

    return gitHub.findAssociatedClaNames(repoId, accessToken.getToken());
}

From source file:fr.mby.utils.spring.beans.factory.BasicProxywiredManager.java

@Override
public Set<String> viewProxywiredDependencies(final IProxywiredIdentifier identifier) {
    Assert.notNull(identifier, "No IProxywiredIdentifier provided !");

    Set<String> view = Collections.emptySet();

    final IManageableProxywired alreadyProxy = this.byIdStorage.get(identifier);
    if (alreadyProxy != null) {
        view = alreadyProxy.viewProxywiredDependencies();
    }// ww  w  . java2  s  .  c om

    return view;
}

From source file:hudson.plugins.sonar.utils.PathResolverOperator.java

protected Set<String> doResolvePath(String key, String path) throws IOException, InterruptedException {
    if (MapUtils.isNotEmpty(resolverMap) && resolverMap.containsKey(key)) {
        return resolverMap.get(key).resolvePath(workspace, path);
    }/*from  w ww  .j  ava 2s.  co m*/

    if (defaultPathResolver != null) {
        return this.defaultPathResolver.resolvePath(this.workspace, path);
    }

    return Collections.emptySet();
}

From source file:com.mingo.convert.ConverterService.java

private Set<Class<? extends Converter>> getConvertersClasses(String converterPackage, ClassLoader classLoader) {
    Set<Class<? extends Converter>> classes = Collections.emptySet();
    try {//from  ww  w .j a v a2s  .c  o m
        ClassPath classPath = ClassPath.from(classLoader);
        Set<com.google.common.reflect.ClassPath.ClassInfo> classInfos = classPath
                .getTopLevelClassesRecursive(converterPackage);
        if (CollectionUtils.isNotEmpty(classInfos)) {
            classes = Sets.newHashSet();
            for (com.google.common.reflect.ClassPath.ClassInfo classInfo : classInfos) {
                Class converterClass = Class.forName(classInfo.getName());
                if (Converter.class.isAssignableFrom(converterClass)
                        && classInfo.getName().contains(converterPackage)) {
                    classes.add(converterClass);
                }
            }
        }
    } catch (IOException | ClassNotFoundException e) {
        throw new RuntimeException(format(CONVERTER_LOAD_ERROR, converterPackage), e);
    }
    return classes;
}