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.puppetlabs.geppetto.forge.v2.service.UserService.java

/**
 * @param name//from   www. j  a v a2 s  . c  om
 *            The name of the user
 * @param listPreferences
 *            Pagination preferences or <code>null</code> to get all in no particular order
 * @return Modules for a particular user
 * @throws IOException
 */
public List<Module> getModules(String name, ListPreferences listPreferences) throws IOException {
    List<Module> modules = null;
    try {
        modules = getClient(false).get(getUserPath(name) + "/modules", toQueryMap(listPreferences),
                Constants.LIST_MODULE);
    } catch (HttpResponseException e) {
        if (e.getStatusCode() != HttpStatus.SC_NOT_FOUND)
            throw e;
    }
    if (modules == null)
        modules = Collections.emptyList();
    return modules;
}

From source file:com.heliosdecompiler.helios.gui.controller.PathEditorController.java

@FXML
private void initialize() {
    this.list.setCellFactory(TextFieldListCell.forListView());

    List<String> path = configuration.getList(String.class, Settings.PATH_KEY, Collections.emptyList());
    this.list.getItems().addAll(path);

    stage = new Stage();
    stage.setOnCloseRequest(event -> {
        event.consume();//  w  ww.j  a  v a2s .  co m
        stage.hide();
        this.list.getItems().removeAll(Arrays.asList(null, ""));
        configuration.setProperty(Settings.PATH_KEY, this.list.getItems());
        eventBus.post(new PathUpdatedEvent());
        pathController.reload();
    });
    stage.setScene(new Scene(root));
    stage.getIcons().add(new Image(getClass().getResourceAsStream("/res/icon.png")));
    stage.setTitle("Edit Path");
}

From source file:com.dianping.lion.dao.ibatis.UserIbatisDao.java

@SuppressWarnings("unchecked")
@Override/*from w  ww  .  j a  va2  s. c  o m*/
public List<User> findByNameOrLoginNameLike(String name, boolean includeSystem) {
    if (StringUtils.isBlank(name)) {
        return Collections.emptyList();
    }
    return getSqlMapClientTemplate().queryForList("User.findByNameOrLoginNameLike",
            Maps.entry("name", name).entry("includeSystem", includeSystem).get());
}

From source file:com.javacreed.apps.mail.Model.java

public List<Email> formatEmails() {
    return Collections.emptyList();
}

From source file:uk.co.flax.biosolr.ontology.core.ols.graph.Graph.java

/**
 * Look up all edges, optionally including child relationships.
 * @param iri the IRI of the source of the relationship.
 * @param includeParentRelations <code>true</code> if parent nodes
 *                              should be included in the results.
 * @return a collection of {@link Edge} entries for the graph. Never
 * <code>null</code>.//w w w . j  a  v a  2 s. co  m
 */
public Collection<Edge> getEdgesBySource(String iri, boolean includeParentRelations) {
    Collection<Edge> ret;

    if (edges != null) {
        ret = edges.stream().filter(e -> iri.equals(e.getSource()))
                .filter(e -> includeParentRelations || !e.isChildRelation()).collect(Collectors.toList());
    } else {
        ret = Collections.emptyList();
    }

    return ret;
}

From source file:com.streamsets.pipeline.stage.destination.SimpleTestInputFormat.java

@Override
public List<InputSplit> getSplits(JobContext jobContext) throws IOException, InterruptedException {
    Configuration conf = jobContext.getConfiguration();

    if (conf.getBoolean(THROW_EXCEPTION, false)) {
        throw new IOException("Throwing exception as instructed, failure in bootstraping MR job.");
    }/* ww  w .  j  ava 2 s .c  o  m*/

    String fileLocation = conf.get(FILE_LOCATION);
    if (fileLocation != null) {
        FileUtils.writeStringToFile(new File(fileLocation), conf.get(FILE_VALUE));
    }

    return Collections.emptyList();
}

From source file:org.brekka.pegasus.core.services.impl.ReaperServiceImpl.java

@Override
@Scheduled(fixedDelay = 5000) // Gap of five seconds between each invocation
@Transactional()/*w ww  .  ja v a2s  . c  o m*/
public void clearAllocationFiles() {
    List<AllocationFile> allocationFileList = Collections.emptyList();
    do {
        allocationFileList = this.allocationFileDAO.retrieveOldestExpired(this.maxAllocationFileCount);
        for (AllocationFile allocationFile : allocationFileList) {
            this.allocationService.clearAllocationFile(allocationFile);
        }
        // Keep looping until there are no more entries to expire
    } while (!allocationFileList.isEmpty());
}

From source file:Main.java

/**
 * Wraps an {@link ExecutorService} in such a way as to &quot;protect&quot;
 * it for calls to the {@link ExecutorService#shutdown()} or
 * {@link ExecutorService#shutdownNow()}. All other calls are delegated as-is
 * to the original service. <B>Note:</B> the exposed wrapped proxy will
 * answer correctly the {@link ExecutorService#isShutdown()} query if indeed
 * one of the {@code shutdown} methods was invoked.
 *
 * @param executorService The original service - ignored if {@code null}
 * @param shutdownOnExit  If {@code true} then it is OK to shutdown the executor
 *                        so no wrapping takes place.
 * @return Either the original service or a wrapped one - depending on the
 * value of the <tt>shutdownOnExit</tt> parameter
 */// ww  w.  j  av  a  2  s.  c  om
public static ExecutorService protectExecutorServiceShutdown(final ExecutorService executorService,
        boolean shutdownOnExit) {
    if (executorService == null || shutdownOnExit) {
        return executorService;
    } else {
        return (ExecutorService) Proxy.newProxyInstance(resolveDefaultClassLoader(executorService),
                new Class<?>[] { ExecutorService.class }, new InvocationHandler() {
                    private final AtomicBoolean stopped = new AtomicBoolean(false);

                    @Override
                    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                        String name = method.getName();
                        if ("isShutdown".equals(name)) {
                            return stopped.get();
                        } else if ("shutdown".equals(name)) {
                            stopped.set(true);
                            return null; // void...
                        } else if ("shutdownNow".equals(name)) {
                            stopped.set(true);
                            return Collections.emptyList();
                        } else {
                            return method.invoke(executorService, args);
                        }
                    }
                });
    }
}

From source file:com.xixicm.de.presentation.view.adapter.SentenceDetailPageAdapter.java

public void setSentences(List<? extends Sentence> sentences) {
    mSentences = sentences;/* www  .  j a v  a2 s .  c  om*/
    if (sentences == null) {
        mSentences = Collections.emptyList();
    }
    notifyDataSetChanged();
}

From source file:io.pivotal.strepsirrhini.chaoslemur.reporter.DataDogReporterTest.java

@Test
public void sendEvent() {
    this.mockServer.expect(requestTo(URI)).andExpect(method(HttpMethod.POST))
            .andRespond(withSuccess("resultSuccess", MediaType.TEXT_PLAIN));

    this.dataDog.sendEvent(new Event(UUID.randomUUID(), Collections.emptyList()));

    this.mockServer.verify();
}