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:de.tudarmstadt.lt.utilities.annotators.StopwordTokenFilter.java

@Override
public void initialize(UimaContext context) throws ResourceInitializationException {
    super.initialize(context);
    _stopwords = new HashSet<String>();
    LOG.debug("Stopword file: {}.", _stopwordsfile);
    if (_stopwordsfile != null) {
        LOG.info("Reading stopword file: {}.)", new File(_stopwordsfile.getFile()).getAbsolutePath());
        // if (!(_stopwordsfile.exists() && _stopwordsfile.isFile())) {
        // // TODO: maintain default stopword list in classpath
        // }//from ww  w  . j a  v a2s .c  om
        try {
            for (String line : IOUtils.readLines(new FileReader(_stopwordsfile.getFile())))
                _stopwords.add(line.trim().toLowerCase());
        } catch (Throwable t) {
            for (int i = 0; t != null; i++) {
                LOG.error(String.format("Failed to read stopword file: %s (%d-%s: %s).)", _stopwordsfile, i,
                        t.getClass().getName(), t.getMessage()), t);
                t = t.getCause();
            }
            _stopwords = Collections.emptySet();
        }
    }
}

From source file:com.opengamma.engine.function.MarketDataSourcingFunction.java

@Override
public Set<ValueRequirement> getRequirements(FunctionCompilationContext context, ComputationTarget target,
        final ValueRequirement desiredValue) {
    // None by design.
    return Collections.emptySet();
}

From source file:net.dv8tion.jda.core.events.http.HttpRequestEvent.java

public Set<String> getCFRays() {
    return this.response == null ? Collections.emptySet() : this.response.getCFRays();
}

From source file:com.navercorp.pinpoint.common.server.util.AgentEventType.java

private Set<AgentEventTypeCategory> asSet(AgentEventTypeCategory[] category) {
    if (ArrayUtils.isEmpty(category)) {
        return Collections.emptySet();
    }//from   w w w  .j a  va  2s .  c o  m
    return EnumSet.copyOf(Arrays.asList(category));
}

From source file:org.spring.data.gemfire.cache.ClientCacheFunctionExecutionWithStreamingTest.java

@Test
public void testClientServerFunctionExecution() {
    GemfireOnRegionFunctionTemplate onNumbersFunctionTemplate = new GemfireOnRegionFunctionTemplate(numbers);

    assertThat(onNumbersFunctionTemplate.executeAndextract("addition", Collections.emptySet(), "one", "two"),
            is(equalTo(3)));/*from ww  w  . j a  v a2s  .  c  o m*/

    GemfireOnRegionFunctionTemplate onCollectionsFunctionTemplate = new GemfireOnRegionFunctionTemplate(
            collections);

    List<Object> integers = onCollectionsFunctionTemplate.executeAndextract("streaming", Collections.emptySet(),
            "one");

    assertNotNull(integers);
    //assertEquals(10, integers.size());
    //assertTrue(integers.containsAll(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)));
    assertEquals(2, integers.size());
    assertTrue(integers.containsAll(Arrays.asList(0, 1)));

    assertThat(onNumbersFunctionTemplate.executeAndextract("addition", Collections.emptySet(), "four", "five"),
            is(equalTo(9)));

    List<Object> strings = onCollectionsFunctionTemplate.executeAndextract("streaming", Collections.emptySet(),
            "two");

    assertNotNull(strings);
    //assertEquals(3, strings.size());
    //assertTrue(strings.containsAll(Arrays.asList("assert", "mock", "test")));
    assertEquals(2, strings.size());
    assertTrue(strings.containsAll(Arrays.asList("assert", "mock")));
}

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

private void updateList(boolean ignoreIfSelectionSame) {
    Selection sel = selection;//  w  ww  . ja v  a2s.  c  o  m
    Set<Component> oldSel = selected;
    Set<Component> newSel;
    if (sel == null)
        newSel = Collections.emptySet();
    else
        newSel = createSet(sel.getComponents());
    if (haveSameElements(newSel, oldSel)) {
        if (ignoreIfSelectionSame)
            return;
        newSel = oldSel;
    } else {
        for (Component o : oldSel) {
            if (!newSel.contains(o)) {
                o.getAttributeSet().removeAttributeListener(listener);
            }
        }
        for (Component o : newSel) {
            if (!oldSel.contains(o)) {
                o.getAttributeSet().addAttributeListener(listener);
            }
        }
    }

    LinkedHashMap<Attribute<Object>, Object> attrMap = computeAttributes(newSel);
    boolean same = isSame(attrMap, this.attrs, this.values);

    if (same) {
        if (newSel != oldSel)
            this.selected = newSel;
    } else {
        Attribute<?>[] oldAttrs = this.attrs;
        Object[] oldValues = this.values;
        Attribute<?>[] newAttrs = new Attribute[attrMap.size()];
        Object[] newValues = new Object[newAttrs.length];
        boolean[] newReadOnly = new boolean[newAttrs.length];
        int i = -1;
        for (Map.Entry<Attribute<Object>, Object> entry : attrMap.entrySet()) {
            i++;
            newAttrs[i] = entry.getKey();
            newValues[i] = entry.getValue();
            newReadOnly[i] = computeReadOnly(newSel, newAttrs[i]);
        }
        if (newSel != oldSel)
            this.selected = newSel;
        this.attrs = newAttrs;
        this.attrsView = UnmodifiableList.decorate(Arrays.asList(newAttrs));
        this.values = newValues;
        this.readOnly = newReadOnly;

        boolean listSame = oldAttrs != null && oldAttrs.length == newAttrs.length;
        if (listSame) {
            for (i = 0; i < oldAttrs.length; i++) {
                if (!oldAttrs[i].equals(newAttrs[i])) {
                    listSame = false;
                    break;
                }
            }
        }

        if (listSame) {
            for (i = 0; i < oldValues.length; i++) {
                Object oldVal = oldValues[i];
                Object newVal = newValues[i];
                boolean sameVals = oldVal == null ? newVal == null : oldVal.equals(newVal);
                if (!sameVals) {
                    @SuppressWarnings("unchecked")
                    Attribute<Object> attr = (Attribute<Object>) oldAttrs[i];
                    fireAttributeValueChanged(attr, newVal);
                }
            }
        } else {
            fireAttributeListChanged();
        }
    }
}

From source file:org.openlmis.fulfillment.repository.custom.impl.OrderRepositoryImpl.java

/**
 * Method returns all Orders with matched parameters. This method ignore if user has right for
 * order. Use it only with service based tokens.
 *
 * @param params search params (supplyingFacility, requestingFacility, program, statuses)
 * @param processingPeriodIds set of Processing Period UUIDs
 * @param pageable page parameters/*w w  w . j  a  va  2s  . com*/
 * @return List of Orders with matched parameters.
 */
@Override
public Page<Order> searchOrders(OrderSearchParams params, Set<UUID> processingPeriodIds, Pageable pageable) {
    return search(params, processingPeriodIds, pageable, Collections.emptySet(), Collections.emptySet());
}

From source file:com.amazon.speech.speechlet.servlet.ServletSpeechletRequestHandler.java

/**
 * Returns a {@link ApplicationIdSpeechletRequestEnvelopeVerifier} configured using the
 * supported application IDs provided by the system property
 * {@link Sdk#SUPPORTED_APPLICATION_IDS_SYSTEM_PROPERTY}. If the supported application IDs are
 * not defined, then an {@link ApplicationIdSpeechletRequestVerifier} initialized with an empty
 * set is returned./* w ww .  j  a  v  a2s  .c om*/
 *
 * @return a configured {@link ApplicationIdSpeechletRequestVerifier}
 */
private static ApplicationIdSpeechletRequestEnvelopeVerifier getApplicationIdVerifier() {
    // Build an application ID verifier from a comma-delimited system property value
    Set<String> supportedApplicationIds = Collections.emptySet();
    String commaDelimitedListOfSupportedApplicationIds = System
            .getProperty(Sdk.SUPPORTED_APPLICATION_IDS_SYSTEM_PROPERTY);
    if (!StringUtils.isBlank(commaDelimitedListOfSupportedApplicationIds)) {
        supportedApplicationIds = new HashSet<String>(
                Arrays.asList(commaDelimitedListOfSupportedApplicationIds.split(",")));
    }

    return new ApplicationIdSpeechletRequestEnvelopeVerifier(supportedApplicationIds);
}

From source file:edu.cornell.mannlib.vivo.orcid.controller.OrcidConfirmationState.java

public void reset(String uri, String profileUrl) {
    progress = START;//from  w  w w  .  j  a va2  s  .  com
    individualUri = uri;
    existingOrcids = Collections.emptySet();
    profile = null;
    profilePageUrl = profileUrl;
}

From source file:org.avidj.zuul.core.DefaultEmbeddedLockManager.java

@Override
public Set<Lock> getLocks(String id) {
    final Session session = sessions.get(id);
    if (session == null) {
        return Collections.emptySet();
    }//  w w  w  .  j  a v  a  2 s. co  m
    final Set<Lock> locks = new HashSet<>();
    for (LockTreeNode node : session.getLocks()) {
        Lock lock = node.getLock(id);
        if (lock != null) {
            locks.add(lock);
        }
    }
    return Collections.unmodifiableSet(locks);
}