Example usage for java.util Collections singletonList

List of usage examples for java.util Collections singletonList

Introduction

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

Prototype

public static <T> List<T> singletonList(T o) 

Source Link

Document

Returns an immutable list containing only the specified object.

Usage

From source file:com.employee.scheduler.nurserostering.solver.move.EmployeeMultipleChangeMove.java

public Collection<? extends Object> getPlanningEntities() {
    return Collections.singletonList(shiftAssignmentList);
}

From source file:io.cloudslang.lang.compiler.modeller.transformers.InputsTransformer.java

@Override
public List<Scope> getScopes() {
    return Collections.singletonList(Scope.BEFORE_EXECUTABLE);
}

From source file:com.photon.phresco.service.admin.actions.components.Features.java

public String save() {
    S_LOGGER.debug("Entering Method  Features.save()");

    try {//from ww  w  . j a  v  a  2 s . c  o m
        if (validateForm()) {
            setErrorFound(true);
            return SUCCESS;
        }
        InputStream inputStream = new FileInputStream(featureArc);
        /*FileOutputStream outputStream = new FileOutputStream(new File("c:/" + featureArcFileName));
        IOUtils.copy(inputStream, outputStream);*/
        addActionMessage(getText(FEATURE_ADDED, Collections.singletonList(name)));
    } catch (Exception e) {
        addActionError(getText(FEATURE_NOT_ADDED, Collections.singletonList(name)));
    }

    return COMP_FEATURES_LIST;
}

From source file:com.netflix.spinnaker.igor.scm.AbstractCommitController.java

public List<Map<String, Object>> getNotFoundCommitsResponse(String projectKey, String repositorySlug, String to,
        String from, String url) {
    Map<String, Object> eMap = new HashMap<>();
    eMap.put("displayId", "NOT_FOUND");
    eMap.put("id", "NOT_FOUND");
    eMap.put("authorDisplayName", "UNKNOWN");
    eMap.put("timestamp", Instant.now());
    eMap.put("message", String.format("could not find any commits from %s to %s in %s %s/%s", from, to, url,
            projectKey, repositorySlug));
    eMap.put("commitUrl", url);
    return Collections.singletonList(eMap);
}

From source file:index.IndexManager.java

private static List<String> chunkToLength(String text) {
    text = text.replaceAll("\\s+", " ").trim();
    if (text.length() < fieldLength)
        return Collections.singletonList(text);

    int i = 0;//from   ww w. j  a  va 2  s  . c o  m
    List<String> chunks = new LinkedList<>();
    while (true) {
        int hardCutPoint = Math.min(text.length(), i + fieldLength);
        int softCutPoint = text.lastIndexOf(' ', hardCutPoint);
        int endIndex = (softCutPoint > i && hardCutPoint != text.length()) ? softCutPoint : hardCutPoint;

        chunks.add(truncateToLength(text.substring(i, endIndex)).trim());

        if (endIndex == text.length())
            break;
        i = endIndex;
    }
    return chunks;
}

From source file:courtscheduler.solver.move.MatchChangeMove.java

@Override
public Collection<? extends Object> getPlanningEntities() {
    return Collections.singletonList(toMatch);
}

From source file:de.codecentric.boot.admin.services.ApplicationRegistratorTest.java

@Before
public void setup() {
    restTemplate = mock(RestTemplate.class);

    adminProps = new AdminProperties();
    adminProps.setUrl(new String[] { "http://sba:8080", "http://sba2:8080" });

    AdminClientProperties clientProps = new AdminClientProperties();
    clientProps.setManagementUrl("http://localhost:8080/mgmt");
    clientProps.setHealthUrl("http://localhost:8080/health");
    clientProps.setServiceUrl("http://localhost:8080");
    clientProps.setName("AppName");

    registrator = new ApplicationRegistrator(restTemplate, adminProps, clientProps);

    headers = new HttpHeaders();
    headers.setContentType(MediaType.APPLICATION_JSON);
    headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
}

From source file:edu.cornell.mannlib.vitro.webapp.search.indexing.AdditionalURIsForObjectProperties.java

protected List<String> doObjectPropertyStmt(Statement stmt) {
    // Only need to consider the object since the subject 
    // will already be updated in search index as part of 
    // SearchReindexingListener.

    // Also, context nodes are not handled here. They are
    // taken care of in AdditionalURIsForContextNodex.
    if (stmt.getObject().isURIResource())
        return Collections.singletonList(stmt.getObject().as(Resource.class).getURI());
    else/* w  w  w.j  av a2 s  .  com*/
        return Collections.emptyList();
}

From source file:com.michellemay.mappings.MappingsFactoryTest.java

@Test
public void testCreateSimpleMapping() throws Exception {
    // Mapping must have at least a name
    MappingConfig config = new MappingConfig();
    config.name = "test";
    config.casesensitive = true;/*from  ww w. j  av  a  2 s .  c o m*/
    MappingsFactory f = new MappingsFactory(Collections.singletonList(config));
    assertTrue(f.getMappings().containsKey("test"));
    assertTrue(f.getMappings().get("test").getCaseSensitive());
}

From source file:com.bedatadriven.rebar.persistence.mapping.SingleColumnPropertyMapping.java

@Override
public List<ColumnMapping> getColumns() {
    return Collections.singletonList(new ColumnMapping(columnName, getSqlTypeName(), getStmtSetter()));
}