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.haulmont.timesheets.global.DateTimeUtils.java

public static Set<String> getDatesRangeAsSeparateStrings(Date startDate, Date endDate, String format) {
    List<Holiday> holidays = projectsService().getHolidaysForPeriod(startDate, endDate);
    if (CollectionUtils.isEmpty(holidays)) {
        return Collections.emptySet();
    }// ww w  .ja  va 2 s.  c  o m
    Set<String> stringHolidays = new HashSet<>();

    for (Holiday holiday : holidays) {
        stringHolidays.addAll(holidayAsSeparateStrings(holiday, startDate, endDate, format));
    }

    return stringHolidays;
}

From source file:com.exxonmobile.ace.hybris.core.search.solrfacetsearch.provider.impl.VariantProductSource.java

protected Set<ProductModel> getBaseProducts(final Object model) {
    if (model instanceof VariantProductModel) {
        // Collect all the variant products and all their super variants, until the final base product is hit
        final Set<ProductModel> products = new HashSet<ProductModel>();

        ProductModel currentProduct = (ProductModel) model;
        while (currentProduct instanceof VariantProductModel) {
            products.add(currentProduct);
            currentProduct = ((VariantProductModel) currentProduct).getBaseProduct();
        }/*from ww  w  .  ja v  a  2s .  c  om*/

        products.add(currentProduct);
        return products;
    } else if (model instanceof ProductModel) {
        return Collections.singleton((ProductModel) model);
    }
    return Collections.emptySet();
}

From source file:mbenson.annotationprocessing.util.LangModel.java

/**
 * Filter {@link Element}s that match a set of modifiers.
 * //  w  w  w. j a  v a 2s  . c o m
 * @param elements
 * @param modifiers
 * @return Iterable<T>
 */
public static <T extends Element> Iterable<T> filterByModifier(Iterable<T> elements, Modifier... modifiers) {
    final Set<Modifier> modifierSet;
    if (modifiers != null && modifiers.length > 0) {
        modifierSet = new HashSet<Modifier>();
    } else {
        modifierSet = Collections.emptySet();
    }

    Collections.addAll(modifierSet, modifiers);

    ArrayList<T> result = new ArrayList<T>();
    for (T element : elements) {
        if (element.getModifiers().containsAll(modifierSet)) {
            result.add(element);
        }
    }
    return result;
}

From source file:org.arrow.runtime.execution.MultipleEventExecution.java

/**
 * Returns a set of all expected event definition IDs.
 * //from www.  j  ava  2 s . co m
 * @return Set
 */
private Set<String> getExpectedEvendIds() {
    MultipleEventAware mea = (MultipleEventAware) getEntity();
    Set<EventDefinition> definitions = mea.getEventDefinitions();

    if (definitions == null) {
        return Collections.emptySet();
    }
    return definitions.stream().map(EventDefinition::getId).collect(Collectors.toSet());
}

From source file:com.cloudbees.jenkins.support.impl.LoadStats.java

/**
 * {@inheritDoc}
 */
@NonNull
@Override
public Set<Permission> getRequiredPermissions() {
    return Collections.emptySet();
}

From source file:cpcc.commons.pages.ros.RosDeviceDetail.java

/**
 * @return the device parameter list.//from  w  w w  .ja va  2 s  .  com
 */
public Collection<String> getDeviceParameterList() {
    Device device = qm.findDeviceByTopicRoot(deviceDetailLinkContext);
    if (device == null) {
        return Collections.emptySet();
    }

    RosNodeGroup group = nodeService.getDeviceNodes().get(device.getTopicRoot());
    if (group == null) {
        return Collections.emptySet();
    }

    return renderParameterList(group.getCurrentState());
}

From source file:com.googlesource.gerrit.plugins.github.oauth.GitHubLogin.java

public Set<String> getMyOrganisationsLogins() throws IOException {
    if (isLoggedIn()) {
        return hub.getMyOrganizations().keySet();
    } else {//from   w w  w.j av  a 2s.  com
        return Collections.emptySet();
    }
}

From source file:com.nike.cerberus.security.VaultAuthPrincipal.java

private Set<String> extractUserGroups(final VaultClientTokenResponse clientToken) {
    final Map<String, String> meta = clientToken.getMeta();
    final String groupString = meta == null ? "" : meta.get(METADATA_KEY_GROUPS);
    if (StringUtils.isBlank(groupString)) {
        return Collections.emptySet();
    } else {/*from  w  w  w. ja v a  2 s .  com*/
        return ImmutableSet.copyOf(StringUtils.split(groupString, ','));
    }
}

From source file:ch.algotrader.event.EventListenerRegistryImpl.java

@Override
public Set<EventListener<?>> getListeners(final Class<?> eventType) {

    final Set<EventListener<?>> eventListeners = this.listenerMap.get(eventType);
    return eventListeners != null ? new HashSet<>(eventListeners) : Collections.emptySet();
}

From source file:hu.pilar.cjg.HintGeneratorTest.java

@Test
public void testNonJaxb() {
    HintGenerator hg = new HintGenerator(new ObjectMapper());

    XmlHint hint = hg.getHintsFor(Object.class);
    assertNull(hint);//from www .  j  a va 2 s .c  o  m
    hg = new HintGenerator(new ObjectMapper(), (Class parent) -> Collections.emptySet());
}