本文整理汇总了Java中java.util.Map.put方法的典型用法代码示例。如果您正苦于以下问题:Java Map.put方法的具体用法?Java Map.put怎么用?Java Map.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Map
的用法示例。
在下文中一共展示了Map.put方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMessageQueueAllocationResult
import java.util.Map; //导入方法依赖的package包/类
private Map<MessageQueue, String> getMessageQueueAllocationResult(DefaultMQAdminExt defaultMQAdminExt,
String groupName) {
Map<MessageQueue, String> results = new HashMap<>();
try {
ConsumerConnection consumerConnection = defaultMQAdminExt.examineConsumerConnectionInfo(groupName);
for (Connection connection : consumerConnection.getConnectionSet()) {
String clientId = connection.getClientId();
ConsumerRunningInfo consumerRunningInfo = defaultMQAdminExt.getConsumerRunningInfo(groupName, clientId,
false);
for (MessageQueue messageQueue : consumerRunningInfo.getMqTable().keySet()) {
results.put(messageQueue, clientId.split("@")[0]);
}
}
} catch (Exception ignore) {
}
return results;
}
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:18,代码来源:ConsumerProgressSubCommand.java
示例2: onLocationChanged
import java.util.Map; //导入方法依赖的package包/类
@Override
public void onLocationChanged(Location location) {
FirebaseAuth auth = FirebaseAuth.getInstance();
String uid = auth.getCurrentUser().getUid();
DatabaseReference ref = FirebaseDatabase.getInstance().getReference().child("users");
ref.child(uid).child("location").setValue(new Loc(location.getLatitude(), location.getLongitude()));
SharedPreferences prefs = context.getSharedPreferences("USER_DATA", 0);
String group_id = prefs.getString("GROUP_ID", "");
GeoHash geoHash = new GeoHash(location.getLatitude(), location.getLongitude());
Map<String, Object> updates = new HashMap<String, Object>();
updates.put("g", geoHash.getGeoHashString());
updates.put("l", Arrays.asList(location.getLatitude(), location.getLongitude()));
FirebaseDatabase.getInstance().getReference()
.child("group_locations")
.child(group_id)
.child(uid)
.setValue(updates);
EventBus.getDefault().post(location);
}
示例3: serve
import java.util.Map; //导入方法依赖的package包/类
/**
* Override this to customize the server.
* <p/>
* <p/>
* (By default, this delegates to serveFile() and allows directory listing.)
*
* @param session The HTTP session
* @return HTTP response, see class Response for details
*/
public Response serve(IHTTPSession session) {
Map<String, String> files = new HashMap<String, String>();
Method method = session.getMethod();
if (Method.PUT.equals(method) || Method.POST.equals(method)) {
try {
session.parseBody(files);
} catch (IOException ioe) {
return new Response(Response.Status.INTERNAL_ERROR, MIME_PLAINTEXT, "SERVER INTERNAL ERROR: IOException: " + ioe.getMessage());
} catch (ResponseException re) {
return new Response(re.getStatus(), MIME_PLAINTEXT, re.getMessage());
}
}
Map<String, String> parms = session.getParms();
parms.put(QUERY_STRING_PARAMETER, session.getQueryParameterString());
return serve(session.getUri(), method, session.getHeaders(), parms, files);
}
示例4: addSubject
import java.util.Map; //导入方法依赖的package包/类
/**
* 添加学科
* @param subject 学科
* @return 返回成功失败
* result :
* success
* data.code : -1参数不合法,学科已存在(与已存在的学科同名);-3添加失败;
*/
@ResponseBody
@RequestMapping("/create")
public CommonResult<Map<String, Object>> addSubject(Subject subject){
CommonResult<Map<String, Object>> result = new CommonResult<Map<String, Object>>(true);
Map<String, Object> map = new HashMap<String, Object>();
int code = 0;
code = subjectService.insert(subject);
code = 0 < code ? 0 : code;
if(0 != code ){
System.out.println("========================================");
System.out.println("code : " + code);
System.out.println("=======================================");
map.put("code", code);
result.setSuccess(false);
}
result.setData(map);
return result;
}
示例5: createEventWithoutDates
import java.util.Map; //导入方法依赖的package包/类
private SystemEvent createEventWithoutDates() {
SystemEvent event = new SystemEvent();
Map<String, Object> data = new HashMap<>();
event.setData(data);
data.put(Constants.ID, DEFAULT_ID);
data.put(Constants.NAME, DEFAULT_FIRST_NAME + " " + DEFAULT_LAST_NAME);
data.put(Constants.IMAGE_URL, DEFAULT_IMAGE_URL);
data.put(Constants.CREATED_DATE, "");
data.put(Constants.LAST_MODIFIED_DATE, "");
data.put(Constants.USER_KEY, DEFAULT_USER_KEY);
TenantInfo info = new TenantInfo(null, DEFAULT_USER_LOGIN, null, null, null, null, null);
event.setTenantInfo(info);
return event;
}
示例6: processAllReplicasRegistration
import java.util.Map; //导入方法依赖的package包/类
public void processAllReplicasRegistration(UUID[] ids, ReplicaConfig[] configs, UUID mainClusterId) {
LOGGER.info("[G] Registering replica for clusters {} in {}", ids, f(clusterId));
Map<UUID, ReplicaMetadata> map = new HashMap<>(ids.length);
for (int i = 0; i < ids.length; i++) {
map.put(ids[i], new ReplicaMetadata(configs[i], false));
}
replicasMetadatas.set(map);
main.set(mainClusterId);
ignite.compute().broadcast(new PublisherUpdater());
}
示例7: toMap
import java.util.Map; //导入方法依赖的package包/类
private static Map<String, String> toMap(List<KeyValue> params) {
Map<String, String> map = new HashMap<>();
for (KeyValue keyValue : params) {
if (!map.containsKey(keyValue.key())) {
map.put(keyValue.key(), keyValue.value());
}
}
return Collections.unmodifiableMap(map);
}
示例8: listLocal
import java.util.Map; //导入方法依赖的package包/类
protected Map<String, LocalResource> listLocal() throws CalendarStorageException {
// fetch list of local contacts and build hash table to index file name
LocalResource[] localList = localCollection.getAll();
Map<String, LocalResource> localResources = new HashMap<>(localList.length);
for (LocalResource resource : localList) {
localResources.put(resource.getFileName(), resource);
}
return localResources;
}
示例9: testContainsValue
import java.util.Map; //导入方法依赖的package包/类
@Test
public void testContainsValue() {
Map<SimpleKey, SimpleValue> map = redisson.getMap("simple");
map.put(new SimpleKey("1"), new SimpleValue("2"));
map.put(new SimpleKey("33"), new SimpleValue("44"));
map.put(new SimpleKey("5"), new SimpleValue("6"));
Assert.assertTrue(map.containsValue(new SimpleValue("2")));
Assert.assertFalse(map.containsValue(new SimpleValue("441")));
Assert.assertFalse(map.containsValue(new SimpleKey("5")));
}
示例10: testReadArgumentsFromPropertyFile
import java.util.Map; //导入方法依赖的package包/类
@Test
public void testReadArgumentsFromPropertyFile() throws IOException {
final Map<String, String> result = new HashMap<String, String>();
OperatorClient.readArgumentsFromPropertyFile(result, TEST_PROPERTIES);
final Map<String, String> expected = new HashMap<String, String>();
expected.put("key1", "aaa");
expected.put("key2", "bbb");
expected.put("key3", "ccc");
assertEquals(expected, result);
}
示例11: headers
import java.util.Map; //导入方法依赖的package包/类
private static Map<String, String> headers(String httpResponse) {
Map<String, String> hs = new HashMap<>();
boolean firstLine = true;
for (String line: httpResponse.split("\\\r\\\n")) {
if (line.equals("")) { break; }
if (firstLine) {
firstLine = false;
continue;
}
String[] parts = line.split(": *", 2);
hs.put(parts[0].toLowerCase(), parts[1]);
}
return hs;
}
示例12: TerminalNode
import java.util.Map; //导入方法依赖的package包/类
public TerminalNode(Rdf source, int model) {
super(source, model);
Map<String,TerminalNode> terminalNodes = modelTerminalNodes.get(model);
if (terminalNodes == null) {
terminalNodes = new HashMap<String,TerminalNode>();
modelTerminalNodes.put(model, terminalNodes);
}
terminalNodes.put(source.getId(), this);
log.debug("Created TerminalNode");
}
示例13: ComplexTypePropertyDocHandler
import java.util.Map; //导入方法依赖的package包/类
/**
* .
*/
@SuppressWarnings("unchecked")
@Test
public void 階層2にComplex型のProperty追加後_制限値を超えた場合異常を通知すること() {
String testENTITY = "testEntity";
org.odata4j.edm.EdmEntityType.Builder entityType = EntityTypeを作成(testENTITY);
List<EdmComplexType.Builder> cpBuilderList = new ArrayList<EdmComplexType.Builder>();
EdmComplexType.Builder ctBuilder = EntityTypeにcomplex型Propertyを1つ作成("newComplexType", entityType);
EdmDataServices.Builder builder = EdmDataServices.newBuilder();
cpBuilderList.add(ctBuilder);
// ここが2階層目となる
ComplexTypeにsimple型Propertyを指定数作成(50, ctBuilder);
Builder targetComplexTypeBuilder = ComplexTypeにcomplex型Propertyを指定数作成(5, "newComplexType2", ctBuilder);
cpBuilderList.add(targetComplexTypeBuilder);
EdmSchema.Builder schema = EdmSchema.newBuilder().addEntityTypes(entityType).setNamespace(NS)
.addComplexTypes(cpBuilderList);
EdmDataServices metadata = builder.addSchemas(schema).build();
PropertyDocHandler handler = new ComplexTypePropertyDocHandler();
JSONObject staticFields = new JSONObject();
staticFields.put("Type", "newComplexType2");
handler.setStaticFields(staticFields);
Map<String, String> entityTypeMap = new HashMap<String, String>();
entityTypeMap.put("_ComplexType.Name_uniqueKey", "newComplexType");
handler.setEntityTypeMap(entityTypeMap);
handler.setEntityTypeId("_uniqueKey");
Map<String, Object> manyToOneKindMap = new HashMap<String, Object>();
manyToOneKindMap.put(ComplexType.EDM_TYPE_NAME, "_uniqueKey");
handler.setManyToOnelinkId(manyToOneKindMap);
PropertyLimitChecker checker = new PropertyLimitChecker(metadata, handler);
List<CheckError> errors = checker.checkPropertyLimits();
assertEquals(1, errors.size());
}
示例14: appInfo
import java.util.Map; //导入方法依赖的package包/类
@Override
public Map<String, Object> appInfo(Map<String, Object> params){
String authId=params.get("auth_id")==null?"":params.get("auth_id").toString().trim();
Map<String, Object> rs = new HashMap<String, Object>();
try {
Map<String, Object> result = new HashMap<String, Object>();
AuthKey key = authKeyDao.query(authId);
if(key==null){
rs.put("flag", "false");
rs.put("error", "[413.1]AuthId Not Found");
return rs;
}
App app =authKeyDao.queryAppByAuthId(authId);
if(null==app){
rs.put("flag","false");
rs.put("error","[413.2]App Not Found");
}else{
result.put("app",app.getInstruct());
result.put("app_name",app.getAppName());
result.put("app_ver",app.getVersion());
result.put("last_update_time",app.getUpdateTime()==null?"":app.getUpdateTime().substring(0,app.getUpdateTime().length()-2));
rs.put("flag","true");
rs.put("error","");
rs.put("result",result);
}
} catch (Exception e) {
String error = ExceptionUtil.getStackTraceAsString(e);
LOG.error("getAuthKey error : "+error);
rs.put("flag", "false");
rs.put("error", "[500]"+error);
}
return rs;
}
示例15: getCustomTokenFilters
import java.util.Map; //导入方法依赖的package包/类
public Map<String, Settings> getCustomTokenFilters() throws IOException {
Map<String, Settings> result = new HashMap<>();
for (Map.Entry<String, String> entry : getCustomThingies(CustomType.TOKEN_FILTER).getAsMap
().entrySet()) {
result.put(entry.getKey(), decodeSettings(entry.getValue()));
}
return result;
}