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.ge.predix.acs.service.policy.evaluation.ResourceAttributeResolver.java

/**
 * @param requestResourceUri/*from www  .j a v  a 2 s  . co  m*/
 *            URI of the resource from the policy evaluation request
 */
public ResourceAttributeResolver(final ResourceAttributeReader resourceAttributeReader,
        final String requestResourceUri, final Set<Attribute> supplementalResourceAttributes) {
    this.resourceAttributeReader = resourceAttributeReader;
    this.requestResourceUri = requestResourceUri;
    if (null == supplementalResourceAttributes) {
        this.supplementalResourceAttributes = Collections.emptySet();
    } else {
        this.supplementalResourceAttributes = supplementalResourceAttributes;
    }
}

From source file:Main.java

/**
 * This method returns a new HashSet which is the intersection of the two Set parameters, based on {@link Object#equals(Object) equality}
 * of their elements.//from  www. ja v  a2 s.com
 * Any references in the resultant set will be to elements within set1.
 * 
 * @return a new HashSet whose values represent the intersection of the two Sets.
 */
public static <T> Set<T> intersect(Set<? extends T> set1, Set<? extends T> set2) {
    if (set1 == null || set1.isEmpty() || set2 == null || set2.isEmpty()) {
        return Collections.emptySet();
    }

    Set<T> result = new HashSet<T>();
    result.addAll(set1);

    result.retainAll(set2);

    return result;
}

From source file:com.cburch.logisim.gui.main.SelectionAttributes.java

public SelectionAttributes(Canvas canvas, Selection selection) {
    this.canvas = canvas;
    this.selection = selection;
    this.listener = new Listener();
    this.listening = true;
    this.selected = Collections.emptySet();
    this.attrs = EMPTY_ATTRIBUTES;
    this.values = EMPTY_VALUES;
    this.attrsView = Collections.emptyList();

    selection.addListener(listener);/*w  w  w.  j av  a  2  s  .com*/
    updateList(true);
    setListening(true);
}

From source file:io.klerch.alexa.tellask.model.wrapper.AlexaRequestStreamHandler.java

/**
 * Provides a set of application-id(s) you can find in the Alexa developer console of your skill.
 * Only requests coming in with these application-id(s) pass the request verification.
 * @return supported application ids/*  w w  w . ja va 2  s.  c om*/
 */
public Set<String> getSupportedApplicationIds() {
    final AlexaApplication app = this.getClass().getAnnotation(AlexaApplication.class);
    return app != null ? Stream.of(app.applicationIds()).collect(Collectors.toSet()) : Collections.emptySet();
}

From source file:com.ge.predix.acs.policy.evaluation.cache.InMemoryPolicyEvaluationCache.java

@Override
Set<String> getResourceTranslations(final String fromKey) {
    Set<String> results = this.resourceTranslations.get(fromKey);
    if (null == results) {
        return Collections.emptySet();
    }/*from   w  w  w .  j av  a2s .c  o  m*/
    return results;
}

From source file:ai.grakn.graql.internal.analytics.CountVertexProgram.java

@Override
public Set<MessageScope> getMessageScopes(final Memory memory) {
    return memory.isInitialIteration() ? messageScopeSetShortcut : Collections.emptySet();
}

From source file:com.redhat.red.offliner.ftest.FoloRecordAvoidedDownloadFTest.java

/**
 * In general, we should only have one test method per functional test. This allows for the best parallelism when we
 * execute the tests, especially if the setup takes some time.
 *
 * @throws Exception In case anything (anything at all) goes wrong!
 *//*from  w  ww.j a v  a 2s  . c  om*/
@Test
public void run() throws Exception {
    // We only need one repo server.
    TestRepositoryServer server = newRepositoryServer();

    // Generate some test content
    byte[] content = contentGenerator.newBinaryContent(1024);

    TrackedContentEntryDTO dto = contentGenerator.newRemoteContentEntry(new StoreKey(StoreType.remote, "test"),
            "jar", server.getBaseUri(), content);

    TrackedContentDTO record = new TrackedContentDTO(new TrackingKey("test-record"), Collections.emptySet(),
            Collections.singleton(dto));

    String path = dto.getPath();

    // Register the generated content by writing it to the path within the repo server's dir structure.
    // This way when the path is requested it can be downloaded instead of returning a 404.
    server.registerContent(path, content);
    server.registerContent(path + Main.SHA_SUFFIX, sha1Hex(content));
    server.registerContent(path + Main.MD5_SUFFIX, md5Hex(content));

    // Write the plaintext file we'll use as input.
    File foloRecord = temporaryFolder.newFile("folo." + getClass().getSimpleName() + ".json");

    FileUtils.write(foloRecord, objectMapper.writeValueAsString(record));

    Options opts = new Options();
    opts.setBaseUrls(Collections.singletonList(server.getBaseUri()));

    // Capture the downloads here so we can verify the content.
    File downloads = temporaryFolder.newFolder();

    opts.setDownloads(downloads);
    opts.setLocations(Collections.singletonList(foloRecord.getAbsolutePath()));

    Main firstMain = run(opts);
    assertThat("Wrong number of downloads logged. Should have been 3 with checksum files included.",
            firstMain.getDownloaded(), equalTo(3));

    //re-run to test the function of avoiding re-downloading existing files
    Main secondMain = run(opts);
    assertThat("Wrong number of downloads logged. Should have been 0.", secondMain.getDownloaded(), equalTo(0));
    assertThat("Wrong number of avoided downloads logged. Should have been 1", secondMain.getAvoided(),
            equalTo(3));
    assertThat("Errors should be empty!", secondMain.getErrors().isEmpty(), equalTo(true));
}

From source file:org.labkey.nashorn.NashornModule.java

@Override
@NotNull
public Set<String> getSchemaNames() {
    return Collections.emptySet();
}

From source file:com.atlassian.jira.web.action.setup.SetupSharedVariables.java

public Set<Cookie> getBundleLicenseCookies() {
    final Object cookies = servletVariables.getHttpSession().getAttribute(SETUP_BUNDLE_LICENSE_COOKIES);

    if (cookies != null) {
        return (Set<Cookie>) cookies;
    }/*from   www  .  j  a v  a2s  . c o  m*/

    return Collections.emptySet();
}

From source file:edu.cornell.mannlib.vitro.webapp.controller.ajax.AbstractAjaxResponder.java

protected Collection<String> getStringParameters(String key) {
    String[] values = vreq.getParameterValues(key);
    if (values == null) {
        return Collections.emptySet();
    } else {/*  w ww. jav  a2 s . co  m*/
        return new HashSet<String>(Arrays.asList(values));
    }
}