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:com.fredhopper.connector.index.provider.FhCategorySource.java

protected Set<CategoryModel> collectSuperCategories(final CategoryModel category,
        final Set<CategoryModel> rootCategories, final Set<CategoryModel> path) {
    if (category == null || isBlockedCategory(category)) {
        // If this category is blocked or null then return empty set as this whole branch is not viable
        return Collections.emptySet();
    }/* w  w  w  .  j  a  v  a  2 s  . c o  m*/

    if (path.contains(category)) {
        // Loop detected, category has already been seen. this whole branch is not viable
        return Collections.emptySet();
    }

    // This category is ok, so add it to our path
    path.add(category);

    if (rootCategories.contains(category)) {
        // We have found the root, so that is the end of this path
        return path;
    } else {
        final List<CategoryModel> superCategories = category.getSupercategories();
        if (superCategories == null || superCategories.isEmpty()) {
            // No super categories, and we haven't found the root yet, so this whole branch is not viable
            return Collections.emptySet();
        }

        if (superCategories.size() == 1) {
            // Optimization for 1 super-category we can reuse our 'path' set
            return collectSuperCategories(superCategories.iterator().next(), rootCategories, path);
        } else {
            final HashSet<CategoryModel> result = new HashSet<>();

            for (final CategoryModel superCategory : superCategories) {
                if (!isBlockedCategory(superCategory)) {
                    // Collect the super category branch for each super-category with a copy of the path so far
                    // Combine together the results
                    result.addAll(collectSuperCategories(superCategory, rootCategories,
                            new HashSet<CategoryModel>(path)));
                }
            }

            return result;
        }
    }
}

From source file:eu.trentorise.smartcampus.permissionprovider.model.ClientDetailsEntity.java

@Override
public Set<String> getResourceIds() {
    if (resourceIds != null) {
        Set<String> set = Utils.delimitedStringToSet(resourceIds, ",");
        set.remove("");
        return set;
    }//from   w  w w.  ja  va  2  s  .  c  om
    return Collections.emptySet();
}

From source file:com.indeed.imhotep.web.ImhotepMetadataCache.java

public Set<String> getKeywordAnalyzerWhitelist(String dataset) {
    if (!datasetToKeywordAnaylzerWhitelist.containsKey(dataset)) {
        return Collections.emptySet();
    }//from  w  w w .  ja  v a2  s  .c  o  m
    return Collections.unmodifiableSet(datasetToKeywordAnaylzerWhitelist.get(dataset));
}

From source file:ee.ria.xroad.proxy.testsuite.MessageTestCase.java

/**
 * @return the provided security category IDs
 */
public Set<SecurityCategoryId> getProvidedCategories() {
    return Collections.emptySet();
}

From source file:com.haulmont.timesheets.gui.timeentry.TimeEntryEdit.java

protected Set<Tag> getAssignedTags(TagType required, Set<TagType> exclude) {
    TimeEntry timeEntry = getItem();/*from  w  ww. jav a2  s.  c  o  m*/
    if (timeEntry == null || CollectionUtils.isEmpty(timeEntry.getTags())) {
        return Collections.emptySet();
    }
    if (required == null && CollectionUtils.isEmpty(exclude)) {
        return getItem().getTags();
    }
    Set<Tag> assigned = new HashSet<>();
    for (Tag tag : timeEntry.getTags()) {
        if (required != null && required.equals(tag.getTagType())
                || required == null && !exclude.contains(tag.getTagType())) {
            assigned.add(tag);
        }
    }
    return assigned;
}

From source file:com.denkbares.semanticcore.utils.ResultTableModel.java

@NotNull
public Collection<TableRow> findRowFor(Value ascendorParent) {
    return getData().getOrDefault(ascendorParent, Collections.emptySet());
}

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

@Override
public Set<String> viewAllDependencies(final Class<?> type) {
    Set<String> view = Collections.emptySet();

    if (type != null) {
        final Map<String, ?> beans = this.beanFactory.getBeansOfType(type);
        if (beans != null) {
            view = beans.keySet();/* ww  w. j  ava 2s .  c  om*/
        }
    }

    return view;
}

From source file:jp.realglobe.util.uploader.DirectoryUploader.java

/**
 * ??/*from  w  w w.j  av  a2s  .c o  m*/
 * @param watchDirectoryPath ??
 * @param delay ?????
 *            ??????????
 * @param latestOnly ????????
 * @param targetExtensions ??
 * @param minSize ???
 * @param maxSize ??
 * @param urlBase ?? URL
 * @param userId ???? ID
 * @param name ??
 * @param store ???
 * @throws Exception ???
 */
public DirectoryUploader(final Path watchDirectoryPath, final long delay, final boolean latestOnly,
        final Collection<String> targetExtensions, final long minSize, final long maxSize, final String urlBase,
        final String userId, final String name, final Store store) throws Exception {
    this.watchDirectoryPath = watchDirectoryPath;
    this.delay = delay;
    this.latestOnly = latestOnly;
    this.targetExtensions = (targetExtensions == null ? Collections.emptySet()
            : new HashSet<>(targetExtensions));
    this.minSize = minSize;
    this.maxSize = maxSize;
    this.userId = userId;
    this.id = getId(store);
    this.name = name;
    this.tokenUrl = (new URL(urlBase + Constants.URL_PATH_TOKEN)).toURI();
    this.uploadUrl = (new URL(
            urlBase + Constants.URL_PATH_UPLOAD_PREFIX + "/" + this.id + Constants.URL_PATH_UPLOAD_SUFFIX))
                    .toURI();
    this.store = store;
    this.token = null;

    LOG.info("ID is " + this.id);
}

From source file:cop.raml.utils.UtilsTest.java

@Test
public void testToEnumStrSet() {
    assertThat(Utils.toEnumStr((Set<String>) null)).isNull();
    assertThat(Utils.toEnumStr(Collections.emptySet())).isNull();
    assertThat(Utils.toEnumStr(new LinkedHashSet<String>() {
        {/*  w w w  .  j av a  2 s  .  c  om*/
            add("one");
            add("two");
        }
    })).isEqualTo("[one,two]");
}

From source file:com.googlecode.fascinator.harvester.workflow.WorkflowHarvester.java

/**
 * Gets a list of digital object IDs. If there are no objects, this method
 * should return an empty list, not null.
 *
 * @return a list of object IDs, possibly empty
 * @throws HarvesterException if there was an error retrieving the objects
 *///  www  .ja va 2s. c  o  m
@Override
public Set<String> getObjectIdList() throws HarvesterException {
    return Collections.emptySet();
}