Example usage for java.util Collections emptyMap

List of usage examples for java.util Collections emptyMap

Introduction

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

Prototype

@SuppressWarnings("unchecked")
public static final <K, V> Map<K, V> emptyMap() 

Source Link

Document

Returns an empty map (immutable).

Usage

From source file:com.sonar.scanner.api.it.tools.CommandExecutor.java

public int execute(String[] args) throws IOException {
    return execute(args, Collections.emptyMap(), null);
}

From source file:com.baidu.cc.configuration.bo.Version.java

/**
 * get config items under this version as map object.<br>
 * ref value will be ingore/*from www . java 2s  . c om*/
 * 
 * @param ignoreRef
 *            if ingore reference value item
 * @return map instance.
 */
public Map<String, String> getConfigItemAsMap(boolean ignoreRef) {
    if (CollectionUtils.isEmpty(configItems)) {
        return Collections.emptyMap();
    }

    Map<String, String> ret = new HashMap<String, String>();
    for (ConfigItem item : configItems) {
        if (item.isRef() && ignoreRef) {
            continue;
        }
        ret.put(item.getName(), item.getVal());
    }

    return ret;
}

From source file:com.haulmont.cuba.security.app.LoginServiceBean.java

@Override
public UserSession login(String login, String password, Locale locale) throws LoginException {
    return login(login, password, locale, Collections.emptyMap());
}

From source file:mtsar.processors.meta.ZenCrowd.java

@Nonnull
@Override/*from  w  w w  .j av  a2s  .c o  m*/
public Map<Integer, AnswerAggregation> aggregate(@Nonnull Collection<Task> tasks) {
    requireNonNull(stage, "the stage provider should not provide null");
    if (tasks.isEmpty())
        return Collections.emptyMap();
    final Map<Integer, Task> taskIds = tasks.stream()
            .collect(Collectors.toMap(Task::getId, Function.identity()));
    final Models.ZenModel<Integer, Integer, String> zenModel = compute(stage, answerDAO, getTaskMap())
            .getZenModel();
    final ZenCrowdEM<Integer, Integer, String> zenCrowd = new ZenCrowdEM<>(zenModel);
    zenCrowd.computeLabelEstimates();
    final Map<Integer, AnswerAggregation> aggregations = zenCrowd.getCurrentModel().getCombinedEstLabels()
            .entrySet().stream().filter(entry -> taskIds.containsKey(entry.getKey()))
            .collect(Collectors.toMap(Map.Entry::getKey, entry -> new AnswerAggregation.Builder()
                    .setTask(taskIds.get(entry.getKey())).addAnswers(entry.getValue().getFirst()).build()));
    return aggregations;
}

From source file:edu.uci.ics.jung.io.GraphMLWriter.java

/**
 * /* ww w. j  a v a2s.com*/
 */
@SuppressWarnings("unchecked")
public GraphMLWriter() {
    vertex_ids = new Transformer<V, String>() {
        public String transform(V v) {
            return v.toString();
        }
    };
    edge_ids = TransformerUtils.nullTransformer();
    graph_data = Collections.emptyMap();
    vertex_data = Collections.emptyMap();
    edge_data = Collections.emptyMap();
    vertex_desc = TransformerUtils.nullTransformer();
    edge_desc = TransformerUtils.nullTransformer();
    graph_desc = TransformerUtils.nullTransformer();
    nest_level = 0;
}

From source file:eu.trentorise.smartcampus.parcheggiausiliari.controller.AbstractObjectController.java

public <T extends GeoObject> List<T> getAllObject(HttpServletRequest request, Class<T> cls) throws Exception {
    try {// w  w  w  .  java  2  s.co  m
        ObjectFilter filterObj = null;
        Map<String, Object> criteria = null;
        String filter = request.getParameter(SEARCH_FILTER_PARAM);
        if (filter != null) {
            filterObj = new ObjectMapper().readValue(filter, ObjectFilter.class);
            criteria = filterObj.getCriteria() != null ? filterObj.getCriteria()
                    : new HashMap<String, Object>();
        } else {
            filterObj = new ObjectFilter();
            criteria = Collections.emptyMap();
        }

        if (filterObj.getSkip() == null) {
            filterObj.setSkip(0);
        }
        if (filterObj.getLimit() == null || filterObj.getLimit() < 0) {
            filterObj.setLimit(100);
        }

        Circle circle = null;
        if (filterObj.getCenter() != null && filterObj.getRadius() != null) {
            circle = new Circle(filterObj.getCenter()[0], filterObj.getCenter()[1], filterObj.getRadius());
        }
        List<T> objects = null;

        objects = storage.searchObjects((Class<T>) cls, circle, criteria, filterObj.getLimit(),
                filterObj.getSkip());

        if (objects != null) {
            return objects;
        }
    } catch (Exception e) {
        logger.error("failed to find objects: " + e.getMessage());
        e.printStackTrace();
    }
    return Collections.emptyList();
}

From source file:io.vertigo.orchestra.webservices.OrchestraWsTest.java

@BeforeClass
public static void setUp() {
    app = new AutoCloseableApp(MyAppConfig.configWithVega());

    final OrchestraDefinitionManager orchestraDefinitionManager = Home.getApp().getComponentSpace()
            .resolve(OrchestraDefinitionManager.class);
    final OrchestraServices orchestraServices = Home.getApp().getComponentSpace()
            .resolve(OrchestraServices.class);

    final ProcessDefinition processDefinition = ProcessDefinition.builder("TEST_BASIC", "TEST BASIC")
            .addActivity("DUMB ACTIVITY", "DUMB ACTIVITY", EmptyActivityEngine.class).build();

    final ProcessDefinition processDefinition2 = ProcessDefinition.builder("TEST_BASIC_2", "TEST BASIC_2")
            .addActivity("DUMB ACTIVITY_2", "DUMB ACTIVITY",
                    io.vertigo.orchestra.services.execution.engine.EmptyActivityEngine.class)
            .addActivity("DUMB ACTIVITY_3", "DUMB ACTIVITY",
                    io.vertigo.orchestra.services.execution.engine.DumbErrorActivityEngine.class)
            .build();/*from  w  ww.j  av a  2 s  .  c  om*/

    orchestraDefinitionManager.createOrUpdateDefinition(processDefinition);
    orchestraServices.getScheduler().scheduleAt(processDefinition, DateUtil.newDateTime(),
            Collections.emptyMap());
    orchestraDefinitionManager.createOrUpdateDefinition(processDefinition2);
    orchestraServices.getScheduler().scheduleAt(processDefinition2, DateUtil.newDateTime(),
            Collections.emptyMap());

    RestAssured.registerParser("plain/text", Parser.TEXT);
    RestAssured.given().filter(loggedSessionFilter).get("/test/login");

}

From source file:com.sonatype.nexus.perftest.maven.StagingOperation.java

@Override
public void perform(ClientRequestInfo requestInfo) throws IOException {
    final int threadId = requestInfo.getClientId();
    final int stageCount = requestInfo.getRequestId();

    StagingWorkflowV3Service staging = getNexusClient(new JerseyStagingWorkflowV3SubsystemFactory())
            .getSubsystem(StagingWorkflowV3Service.class);

    Profile profile = getProfile(staging, PROFILE_NAME);
    Map<String, String> tags = Collections.emptyMap();
    String repositoryId = staging.startStaging(profile,
            String.format("started staging %02d-%03d", threadId, stageCount), tags);

    deployArtifacts(staging.startedRepositoryBaseUrl(profile, repositoryId), threadId, stageCount);

    staging.finishStaging(profile, repositoryId,
            String.format("finish staging %02d-%03d", threadId, stageCount));

    staging.releaseStagingRepositories(String.format("release staging %02d-%03d", threadId, stageCount),
            repositoryId);/*from   ww  w  . j  a va 2s  .  co m*/

    try {
        staging.dropStagingRepositories(String.format("drop staging %02d-%03d", threadId, stageCount),
                repositoryId);
    } catch (ClientHandlerException e) {
        // appears to be expected with Nexus 2.4
    }
}

From source file:org.elasticsearch.client.RankEvalIT.java

@Before
public void indexDocuments() throws IOException {
    StringEntity doc = new StringEntity("{\"text\":\"berlin\"}", ContentType.APPLICATION_JSON);
    client().performRequest("PUT", "/index/doc/1", Collections.emptyMap(), doc);
    doc = new StringEntity("{\"text\":\"amsterdam\"}", ContentType.APPLICATION_JSON);
    client().performRequest("PUT", "/index/doc/2", Collections.emptyMap(), doc);
    client().performRequest("PUT", "/index/doc/3", Collections.emptyMap(), doc);
    client().performRequest("PUT", "/index/doc/4", Collections.emptyMap(), doc);
    client().performRequest("PUT", "/index/doc/5", Collections.emptyMap(), doc);
    client().performRequest("PUT", "/index/doc/6", Collections.emptyMap(), doc);
    client().performRequest("POST", "/index/_refresh");

    // add another index to test basic multi index support
    client().performRequest("PUT", "/index2/doc/7", Collections.emptyMap(), doc);
    client().performRequest("POST", "/index2/_refresh");
}