Example usage for java.util Collections EMPTY_LIST

List of usage examples for java.util Collections EMPTY_LIST

Introduction

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

Prototype

List EMPTY_LIST

To view the source code for java.util Collections EMPTY_LIST.

Click Source Link

Document

The empty list (immutable).

Usage

From source file:org.syncope.console.rest.TaskRestClient.java

/**
 * Return a paginated list of tasks./*from  ww w  .  j av a 2s  .co m*/
 *
 * @param page number.
 * @param size per page.
 * @return paginated list.
 */
public <T extends TaskTO> List<T> listTasks(final Class<T> reference, final int page, final int size) {

    List<T> result = Collections.EMPTY_LIST;

    if (PropagationTaskTO.class == reference) {
        result = (List<T>) Arrays.asList(restTemplate.getForObject(
                baseURL + "task/propagation/list/{page}/{size}.json", PropagationTaskTO[].class, page, size));
    } else if (NotificationTaskTO.class == reference) {
        result = (List<T>) Arrays.asList(restTemplate.getForObject(
                baseURL + "task/notification/list/{page}/{size}.json", NotificationTaskTO[].class, page, size));
    } else if (SchedTaskTO.class == reference) {
        result = (List<T>) Arrays.asList(restTemplate
                .getForObject(baseURL + "task/sched/list/{page}/{size}.json", SchedTaskTO[].class, page, size));
    } else if (SyncTaskTO.class == reference) {
        result = (List<T>) Arrays.asList(restTemplate
                .getForObject(baseURL + "task/sync/list/{page}/{size}.json", SyncTaskTO[].class, page, size));
    }

    return result;
}

From source file:fi.smaa.jsmaa.gui.SMAATRIGUIFactory.java

@SuppressWarnings("unchecked")
public SMAATRIGUIFactory(Window parent, SMAATRIModel smaaModel, MenuDirector director) {
    super(parent, smaaModel, director);
    SMAATRIResults emptyResults = new SMAATRIResults(Collections.EMPTY_LIST, Collections.EMPTY_LIST, 1);
    categoryAcceptabilityTM = new CategoryAcceptabilityTableModel(emptyResults);
    categoryAcceptabilityDataset = new CategoryAcceptabilitiesDataset(emptyResults);
}

From source file:ac.simons.tests.akismet.AkismetTest.java

License:asdf

private AkismetImpl<AkismetComment> newAkismet() {
    Logger logger = LoggerFactory.getLogger(AkismetImpl.class);
    return new AkismetImpl<AkismetComment>(new DefaultHttpClient(), new TypeCoercerImpl(Collections.EMPTY_LIST),
            logger, validApiKey, validApiConsumer, KnownAkismetCompatibleServices.TYPEPAD_ANTISPAM.toString(),
            null);// w w  w . j a va 2s  .  com
}

From source file:com.adobe.acs.commons.data.Spreadsheet.java

/**
 * Simple constructor used for unit testing purposes
 *
 * @param convertHeaderNames If true, header names are converted
 * @param headerArray List of strings for header columns
 *///from w  w w . j a  v  a 2s.  c  o  m
public Spreadsheet(boolean convertHeaderNames, String... headerArray) {
    this.enableHeaderNameConversion = convertHeaderNames;
    headerTypes = Arrays.stream(headerArray)
            .collect(Collectors.toMap(this::convertHeaderName, this::detectTypeFromName));
    headerRow = Arrays.asList(headerArray);
    requiredColumns = Collections.EMPTY_LIST;
    dataRows = new ArrayList<>();
    delimiters = new HashMap<>();
}

From source file:hudson.plugins.clearcase.ClearCaseInstallation.java

@DataBoundConstructor
public ClearCaseInstallation(String home) {
    super(NAME, home, Collections.EMPTY_LIST);
}

From source file:net.mlw.vlh.web.tag.DefaultSelectTag.java

/**
 * @see javax.servlet.jsp.tagext.TagSupport#doEndTag()
 *//*from  w  w  w.ja  v  a  2  s  . co m*/
public int doEndTag() throws JspException {
    ValueListSpaceTag rootTag = (ValueListSpaceTag) JspUtils.getParent(this, ValueListSpaceTag.class);

    ValueList valueList = rootTag.getValueList();

    StringBuffer sb = new StringBuffer();

    sb.append("<select name=").append("'").append(name).append("'").append(attributes).append(">");

    if (bodyContent != null && bodyContent.getString() != null) {
        sb.append(bodyContent.getString());
    }

    try {
        String[] svalues = pageContext.getRequest().getParameterValues(name);
        List values = (svalues == null) ? Collections.EMPTY_LIST : Arrays.asList(svalues);

        for (Iterator iter = valueList.getList().iterator(); iter.hasNext();) {
            Object bean = iter.next();
            String value = BeanUtils.getProperty(bean, this.value);

            sb.append("<option ");
            if (values.contains(value)) {
                sb.append("selected='true' ");
            }
            sb.append("value='").append(value).append("'>");
            sb.append(BeanUtils.getProperty(bean, text));
            sb.append("</option>");
        }
    } catch (Exception e) {
        LOGGER.error("DefaultSelectTag.doEndTag() exception...", e);
        throw new JspException(e);
    }
    sb.append("</select>");

    JspUtils.write(pageContext, sb.toString());

    release();

    return EVAL_PAGE;
}

From source file:ch.entwine.weblounge.contentrepository.impl.index.elasticsearch.FacetedSuggestRequest.java

/**
 * Returns a list of suggestions based on the seed value.
 * //from  w  w w  .  j a va  2s .c o m
 * @param seed
 *          the value to base suggestions on
 * @return the suggestions
 * @throws IllegalArgumentException
 *           if <code>seed</code> is blank
 * @throws SolrServerException
 *           if querying solr fails
 */
public List<String> getSuggestions(String seed) throws IllegalArgumentException, ContentRepositoryException {
    if (StringUtils.isBlank(seed))
        throw new IllegalArgumentException("Seed cannot be blank");

    // TODO: Implement
    return Collections.EMPTY_LIST;
}

From source file:mx.ecosur.multigame.gente.entity.GenteStrategyAgent.java

public List<Move> determineMoves(Game impl) {
    List<Move> ret = new ArrayList<Move>();
    GenteGame game = (GenteGame) impl;//w  w  w. j  a va2  s .  c o m
    GameGrid grid = game.getGrid();

    if (isTurn()) {
        if (kBase == null)
            initialize();
        StatefulKnowledgeSession session = kBase.newStatefulKnowledgeSession();
        session.setGlobal("dim", game.getSize());
        session.insert(this);
        session.insert(ret);
        session.insert(grid);

        /* Insert any unbound adjacent cells if grid is not empty */
        if (!grid.isEmpty()) {
            Set<Color> colors = new HashSet<Color>();
            for (Color c : Color.values()) {
                colors.add(c);
            }

            for (GridCell cell : findUnboundAdjacentCells(game, colors)) {
                session.insert(cell);
            }

            session.setGlobal("unbound", new ArrayList<Move>());

        } else {
            session.setGlobal("unbound", Collections.EMPTY_LIST);
        }

        session.fireAllRules();
        session.dispose();
    }

    Collections.shuffle(ret, new Random());
    return ret;
}

From source file:org.talend.components.api.service.internal.ComponentServiceImplDepsTestIT.java

/**
 * Test method for//from www . j  a  v a 2  s  .c o m
 * {@link org.talend.components.api.service.internal.ComponentServiceImpl#loadPom(java.io.InputStream, org.talend.components.api.service.internal.MavenBooter)}
 * .
 */
@Test
public void testLoadPom() throws ModelBuildingException, URISyntaxException, IOException {
    ComponentServiceImpl componentServiceImpl = new ComponentServiceImpl(null);
    URL pomUrl = this.getClass().getResource("pom.xml"); //$NON-NLS-1$
    final File temporaryFolder = new File(new File(pomUrl.toURI()).getParentFile(), "tempFolder");
    try {
        Model pom = componentServiceImpl.loadPom(this.getClass().getResourceAsStream("pom.xml"),
                new MavenBooter() {

                    @Override
                    File getDefaultLocalRepoDir() {
                        return temporaryFolder;
                    }

                }, Collections.EMPTY_LIST);
        List<Dependency> dependencies = pom.getDependencies();
        checkDependencies(dependencies, "runtime", DIRECT_DEPS.split(",")); //$NON-NLS-1$//$NON-NLS-2$
    } finally {
        FileUtils.deleteDirectory(temporaryFolder);
    }
}

From source file:internal.static_util.scorer.TermRelatednessScorer.java

/**
 * Given a word and a set of its related relatedTerms, returns an ordered list of relatedTerms ranked from most relevant to least.
 *
 * @param original          The word you want to find ranked relatedTerms for
 * @param relatedTerms          The set of terms related to the original
 * @param minRelevanceRatio An optional parameter for the minimum a synonym must score to be returned. If none
 *                          given, .50 is assumed.
 * @return A list of scoredTerms, in descending order of their scores.
 *//*from  w ww  . j av  a 2s.  c  om*/
public static List<ScoredTerm> getRankedTermsWithScores(String original, Set<String> relatedTerms,
        double minRelevanceRatio) {
    // Handle null/empty cases
    if (original == null || relatedTerms == null || relatedTerms.isEmpty()) {
        return Collections.EMPTY_LIST;
    }
    // A HashMap with the word as the key, and its corresponding score
    List<ScoredTerm> scoredTerms = Collections.synchronizedList(new ArrayList<>());

    // Open up a parallel stream on the relatedTerms to perform the doc search on them all
    relatedTerms.parallelStream().forEach(term -> scoredTerms.add(new ScoredTerm(term, score(original, term))));

    // TODO: NOTICE: if the change is made to use a 'top ten' type, refactor to just take first 'x' relatedTerms
    // Trim the fat - anything below relevance rank gets the D
    List<ScoredTerm> relevantTerms = getRelevantTerms(scoredTerms, minRelevanceRatio);

    // Use common.data.ScoredTerm's built-in comparator for sorting purposes
    // It is by default in ascending order; we want most relevant first, so reverse it
    Collections.sort(relevantTerms, Comparator.reverseOrder());

    // If there were no relevant relatedTerms, return null.
    // TODO: throw a NoRelevantTerms exception?
    return relevantTerms.size() > 0 ? relevantTerms : Collections.EMPTY_LIST;
}