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:org.jasig.portlet.blackboardvcportlet.service.impl.ConferenceUserServiceImpl.java

@Override
public Set<BasicUser> searchForBasicUserByName(String name) {
    if (this.userService == null) {
        //TODO could fall back to a local db search here
        return Collections.emptySet();
    }//  w  w  w . j  a v a 2  s.  c o  m

    //Normalize the name to try and get extra oomf out of the cache
    final String normalizedName = NAME_NORMALIZER.matcher(name.trim()).replaceAll(" ");

    //Check the local cache of results
    final Serializable cacheKey = createNameSearchCacheKey(normalizedName);
    final Element element = this.userServiceCache.get(cacheKey);
    if (element != null) {
        return (Set<BasicUser>) element.getObjectValue();
    }

    //No cache, perform the search
    final Set<BasicUser> result = this.userService.searchForUserByName(normalizedName);

    //Cache the search result
    this.userServiceCache.put(new Element(cacheKey, result));
    cacheUsers(result);

    return result;
}

From source file:de.ks.flatadocdb.session.Session.java

public void remove(Object entity) {
    Objects.requireNonNull(entity);
    SessionEntry sessionEntry = entity2Entry.get(entity);
    removeSessionEntry(sessionEntry, entity, Collections.emptySet());
}

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

public Set<EventBean> lookupLessEqual(Object keyStart) {
    if (keyStart == null) {
        return Collections.emptySet();
    }// w w w . jav a  2  s  . c o m
    keyStart = coerce(keyStart);
    return normalize(propertyIndex.headMap(keyStart, true));
}

From source file:edu.arizona.kfs.fp.document.validation.impl.UaDisbursementVoucherDocumentPreRules.java

protected Set<String> findDuplicatePaymentRequests(DisbursementVoucherDocument document, String invoiceNumber) {
    DisbursementVoucherPayeeDetail payeeDetail = document.getDvPayeeDetail();
    if (payeeDetail.isVendor()) {
        String vendorHeaderGeneratedIdentifier = payeeDetail.getDisbVchrVendorHeaderIdNumber();
        String vendorDetailAssignedIdentifier = payeeDetail.getDisbVchrVendorDetailAssignedIdNumber();
        return getDisbursementVoucherInvoiceService().findPaymentRequestsWithDuplicateInvoices(
                vendorHeaderGeneratedIdentifier, vendorDetailAssignedIdentifier, invoiceNumber);
    }/*from  w  ww .j a  v  a  2  s  . c om*/
    return Collections.emptySet();
}

From source file:nu.yona.server.subscriptions.rest.BuddyController.java

private GoalDto getGoal(UUID userId, UUID buddyId, UUID goalId) {
    BuddyDto buddy = buddyService.getBuddy(buddyId);
    Optional<GoalDto> goal = buddy.getGoals().orElse(Collections.emptySet()).stream()
            .filter(g -> g.getGoalId().equals(goalId)).findAny();
    return goal.orElseThrow(() -> GoalServiceException.goalNotFoundByIdForBuddy(userId, buddyId, goalId));
}

From source file:com.jxt.web.service.AgentInfoServiceImpl.java

@Override
public Set<AgentInfo> getAgentsByApplicationNameWithoutStatus(String applicationName, long timestamp) {
    if (applicationName == null) {
        throw new NullPointerException("applicationName must not be null");
    }//from  w  w  w . j a va  2 s .  c  om
    if (timestamp < 0) {
        throw new IllegalArgumentException("timestamp must not be less than 0");
    }

    List<String> agentIds = this.applicationIndexDao.selectAgentIds(applicationName);
    List<AgentInfo> agentInfos = this.agentInfoDao.getAgentInfos(agentIds, timestamp);
    CollectionUtils.filter(agentInfos, PredicateUtils.notNullPredicate());
    if (CollectionUtils.isEmpty(agentInfos)) {
        return Collections.emptySet();
    }
    return new HashSet<>(agentInfos);
}

From source file:net.sourceforge.fenixedu.domain.space.SpaceUtils.java

public static boolean isFree(Space space, YearMonthDay startDate, YearMonthDay endDate,
        HourMinuteSecond startTime, HourMinuteSecond endTime, DiaSemana dayOfWeek, FrequencyType frequency,
        Boolean dailyFrequencyMarkSaturday, Boolean dailyFrequencyMarkSunday,
        Set<Class<? extends EventSpaceOccupation>> eventSpaceOccupationClassesToSkip) {
    List<Interval> intervals = null;

    if (eventSpaceOccupationClassesToSkip == null) {
        eventSpaceOccupationClassesToSkip = Collections.emptySet();
    }//from   w ww  .  j av  a2s  .c  om

    for (Occupation spaceOccupation : getResourceAllocationsForCheck(space)) {
        if (spaceOccupation instanceof EventSpaceOccupation) {
            if (eventSpaceOccupationClassesToSkip.contains(spaceOccupation.getClass())) {
                continue;
            }
            EventSpaceOccupation occupation = (EventSpaceOccupation) spaceOccupation;
            if (occupation.alreadyWasOccupiedIn(startDate, endDate, startTime, endTime, dayOfWeek, frequency,
                    dailyFrequencyMarkSaturday, dailyFrequencyMarkSunday)) {
                return false;
            }
        }

        if (spaceOccupation.getClass().equals(Occupation.class)) {
            if (intervals == null) {
                intervals = EventSpaceOccupation.generateEventSpaceOccupationIntervals(startDate, endDate,
                        startTime, endTime, frequency, dayOfWeek, dailyFrequencyMarkSaturday,
                        dailyFrequencyMarkSunday, null, null);
            }
            if (spaceOccupation.overlaps(intervals)) {
                return false;
            }
        }
    }

    return true;
}

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

public Set<String> getNativeAppSignaturesSet() {
    Map<String, Object> additionalInfo = getAdditionalInformation();
    if (additionalInfo != null && additionalInfo.containsKey(KEY_APP_SIGNATURES)) {
        return Utils.delimitedStringToSet(additionalInfo.get(KEY_APP_SIGNATURES).toString(), ",");
    }//from   w  w w  .j  a va2 s .  c  om
    return Collections.emptySet();
}

From source file:com.spotify.heroic.test.AbstractSuggestBackendIT.java

@Test
public void tagSuggestNoIdx() throws Exception {
    final Set<Pair<String, String>> result = getTagSuggest(tagSuggestReq);

    assertEquals(Collections.emptySet(), result);
}

From source file:gov.nih.nci.caintegrator.application.query.ExpressionLevelCriterionHandler.java

private Set<AbstractReporter> findReporters(ReporterTypeEnum reporterType, Study study, Platform platform) {
    Set<ReporterList> studyReporterLists = getStudyReporterLists(study, reporterType, platform);
    if (studyReporterLists.isEmpty()) {
        return Collections.emptySet();
    }/*from  ww w  .  j  a  v a2  s . c o  m*/
    Set<AbstractReporter> reporters = new HashSet<AbstractReporter>();
    for (ReporterList reporterList : studyReporterLists) {
        reporters.addAll(reporterList.getReporters());
    }
    return reporters;
}