Example usage for java.util Collections emptyList

List of usage examples for java.util Collections emptyList

Introduction

In this page you can find the example usage for java.util Collections emptyList.

Prototype

@SuppressWarnings("unchecked")
public static final <T> List<T> emptyList() 

Source Link

Document

Returns an empty list (immutable).

Usage

From source file:com.collective.celos.SerialSchedulingStrategy.java

@Override
public List<SlotState> getSchedulingCandidates(List<SlotState> states) {

    int slotsRunning = CollectionUtils.countMatches(states, RUNNING_PREDICATE);
    if (slotsRunning >= concurrencyLevel) {
        return Collections.emptyList();
    }/*from   w  ww .j a  va2s .  c o m*/

    @SuppressWarnings("unchecked")
    Collection<SlotState> candidates = CollectionUtils.select(states, CANDIDATE_PREDICATE);

    if (!candidates.isEmpty()) {
        int elemsToGet = Math.min(candidates.size(), concurrencyLevel - slotsRunning);
        return Lists.newArrayList(candidates).subList(0, elemsToGet);
    }

    return Collections.emptyList();
}

From source file:no.dusken.aranea.service.ArticleServiceImpl.java

public List<Article> getArticlesByYear(int year, int number, int offset) {
    List<Article> list = Collections.emptyList();
    try {//from  w ww  . j  a va 2s  . c  o  m
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("fromDate", new GregorianCalendar(year, 0, 1));
        map.put("toDate", new GregorianCalendar(year, 11, 31));
        list = genericDao.getByNamedQuery("article_byyear", map, offset, number);
    } catch (DataAccessException dae) {
        log.info("Unable to get Articles", dae);
    }
    return list;
}

From source file:com.haulmont.cuba.gui.ComponentsHelper.java

/**
 * Returns the collection of components within the specified container and all of its children.
 *
 * @param container container to start from
 * @return          collection of components
 *///ww w.  j  a  v  a2 s  . c  om
public static Collection<Component> getComponents(Component.Container container) {
    // do not return LinkedHashSet, it uses much more memory than ArrayList
    Collection<Component> res = new ArrayList<>();

    fillChildComponents(container, res);

    if (res.isEmpty()) {
        return Collections.emptyList();
    }

    return Collections.unmodifiableCollection(res);
}

From source file:cern.molr.mole.impl.RunnableSpringMole.java

@Override
public List<Method> discover(Class<?> classType) {
    if (null == classType) {
        throw new IllegalArgumentException("Class type cannot be null");
    }/*from  ww  w.  jav a 2  s.com*/
    if (Runnable.class.isAssignableFrom(classType)
            && classType.getAnnotation(MoleSpringConfiguration.class) != null) {
        try {
            return Collections.singletonList(classType.getMethod("run"));
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        }
    }

    return Collections.emptyList();
}

From source file:no.dusken.aranea.service.ExternalPageServiceImpl.java

public List<ExternalPage> getPages(int offset, int number) {
    List<ExternalPage> list = Collections.emptyList();
    try {// www.j  a  v  a 2s.  c o  m
        list = genericDao.getByNamedQuery("externalPage_all", null, offset, number);
    } catch (DataAccessException dae) {
        log.info("Unable to get pages", dae);
    }
    return list;
}

From source file:com.reprezen.swagedit.assist.SwaggerProposalProvider.java

public SwaggerProposalProvider() {
    this.extensions = Collections.emptyList();
}

From source file:alfio.manager.system.MockMailer.java

@Override
public void send(Event event, String to, String subject, String text, Optional<String> html,
        Attachment... attachments) {//from  w  ww.  ja  va 2 s.  c om

    String printedAttachments = Optional.ofNullable(attachments).map(Arrays::asList)
            .orElse(Collections.emptyList()).stream()
            .map(a -> "{filename:" + a.getFilename() + ", contentType: " + a.getContentType() + "}")
            .collect(Collectors.joining(", "));

    log.info("Email: from: {}, replyTo: {}, to: {}, subject: {}, text: {}, html: {}, attachments: {}",
            event.getDisplayName(),
            configurationManager.getStringConfigValue(
                    Configuration.from(event.getOrganizationId(), event.getId(), MAIL_REPLY_TO), ""),
            to, subject, text, html.orElse("no html"), printedAttachments);
}

From source file:com.netflix.spinnaker.echo.pubsub.utils.MessageArtifactTranslator.java

public List<Artifact> parseArtifacts(String messagePayload) {
    if (!StringUtils.isNotBlank(messagePayload)) {
        return Collections.emptyList();
    }//from  w  ww .j av  a2  s.  c  om

    ObjectMapper mapper = new ObjectMapper();
    return readArtifactList(mapper, jinjaTransform(mapper, messagePayload));
}

From source file:com.warsaw.data.service.PlaceService.java

private List<Place> getAllCulturePlaces() {
    culturePlaces = new ArrayList<>();

    JSONObject json = this.getJsonFromURL(
            "https://api.um.warszawa.pl/api/action/wfsstore_get/?id=e26218cb-61ec-4ccb-81cc-fd19a6fee0f8&apikey=6259fbb5-468a-476c-be8c-10da5c20ad7a");

    try {/*  w  ww .j a va  2 s  .  co m*/
        culturePlaces = this.getAnyPlaces(json, 4, 5);
    } catch (Exception e) {
        return Collections.emptyList();
    }

    return culturePlaces;
}

From source file:org.openmrs.module.kenyaemr.fragment.controller.PatientSearchFragmentController.java

public List<SimpleObject> search(@RequestParam(value = "q", required = false) String query,
        @RequestParam(value = "which", required = false) String which,
        @RequestParam(value = "age", required = false) Integer age,
        @RequestParam(value = "ageWindow", defaultValue = "5") int ageWindow, UiUtils ui,
        @SpringBean KenyaEmrUiUtils kenyaUi) {

    if ("checked-in".equals(which)) {
        return withActiveVisits(query, age, ageWindow, ui, kenyaUi);
    }//from w  w  w  .ja  va 2 s.  c  om
    if (StringUtils.isBlank(query)) {
        return Collections.emptyList();
    }

    List<Patient> ret = Context.getPatientService().getPatients(query);
    if (age != null) {
        List<Patient> similar = new ArrayList<Patient>();
        for (Patient p : ret) {
            if (Math.abs(p.getAge() - age) <= ageWindow)
                similar.add(p);
        }
        ret = similar;
    }

    List<Visit> activeVisits = Context.getVisitService().getVisits(null, null, null, null, null, null, null,
            null, null, false, false);
    final Map<Integer, Visit> patientActiveVisits = new HashMap<Integer, Visit>();
    for (Visit v : activeVisits) {
        patientActiveVisits.put(v.getPatient().getPatientId(), v);
    }

    List<SimpleObject> matching = kenyaUi.simplePatients(ret, ui);

    for (SimpleObject so : matching) {
        Visit v = patientActiveVisits.get(so.get("patientId"));
        if (v != null) {
            so.put("extra", "<div class='ke-tag ke-visittag'>" + ui.format(v.getVisitType()) + "<br/><small>"
                    + ui.format(v.getStartDatetime()) + "</small></div>");
        }
    }

    return matching;
}