当前位置: 首页>>代码示例>>Java>>正文


Java LinkedHashMap类代码示例

本文整理汇总了Java中java.util.LinkedHashMap的典型用法代码示例。如果您正苦于以下问题:Java LinkedHashMap类的具体用法?Java LinkedHashMap怎么用?Java LinkedHashMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LinkedHashMap类属于java.util包,在下文中一共展示了LinkedHashMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testAddHeaders

import java.util.LinkedHashMap; //导入依赖的package包/类
@Test
public void testAddHeaders(){
	DatarouterHttpRequest request = new DatarouterHttpRequest(HttpRequestMethod.POST, URL, true);

	Map<String,List<String>> expectedHeaders = new LinkedHashMap<>();
	expectedHeaders.put("valid", Arrays.asList("header"));
	Map<String,String> headers = new LinkedHashMap<>();
	headers.put("valid", "header");
	request.addHeaders(headers);
	Assert.assertEquals(request.getHeaders(), expectedHeaders);

	headers.clear();
	headers.put("", "empty");
	headers.put(null, null);
	request.addHeaders(headers);
	Assert.assertEquals(request.getHeaders().size(), 1);

	request.setContentType(ContentType.TEXT_PLAIN);
	Assert.assertEquals(request.getHeaders().size(), 2);

	request.setContentType(ContentType.TEXT_HTML);
	Assert.assertEquals(request.getHeaders().size(), 2);
	Assert.assertEquals(request.getRequest().getAllHeaders().length, 3);
}
 
开发者ID:hotpads,项目名称:datarouter,代码行数:25,代码来源:DatarouterHttpRequestTests.java

示例2: getOrderCounter

import java.util.LinkedHashMap; //导入依赖的package包/类
public static ICounter getOrderCounter(Long domainId, String tag, Integer ordType,  String... tgType) {
  Map<String, Object> map = new LinkedHashMap<>();
  map.put(OBJECT_TYPE, "orders");
  if (tgType != null && tgType.length > 0) {
    switch (tgType[0]) {
      case TYPE_ORDER:
        map.put(O_TAGS, tag);
        break;
      default:
        map.put(K_TAGS, tag);
        break;
    }
  } else {
    map.put(K_TAGS, tag);
  }
  map.put(ORD_TYPE, ordType);
  return getInstance(domainId, map);
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:19,代码来源:Counter.java

示例3: completeSyntheaFields

import java.util.LinkedHashMap; //导入依赖的package包/类
/**
 * Calculates the prevalence rate and percent based on what is on that line of the report. Inserts
 * result of calculation into the prevalence rate and percent columns.
 */
private static void completeSyntheaFields(Connection connection,
    LinkedHashMap<String, String> line) throws SQLException {

  if ((line.get(OCCUR).isEmpty()) || (line.get(POP).isEmpty())) {
    line.put(PREV_RATE, (null));
    line.put(PREV_PERCENT, (null));
  } else {
    double occurr = Double.parseDouble(line.get(OCCUR));
    double pop = Double.parseDouble(line.get(POP));

    if (pop != 0) {
      double prevRate = occurr / pop;
      double prevPercent = prevRate * 100;
      line.put(PREV_RATE, Double.toString(prevRate));
      line.put(PREV_PERCENT, Double.toString(prevPercent));
    } else {
      line.put(PREV_RATE, Double.toString(0));
      line.put(PREV_PERCENT, Double.toString(0));
    }
  }
}
 
开发者ID:synthetichealth,项目名称:synthea_java,代码行数:26,代码来源:PrevalenceReport.java

示例4: saveSuperviseMatter

import java.util.LinkedHashMap; //导入依赖的package包/类
@Override
public Object saveSuperviseMatter(String token, Map taskForm) {
    UserVO user = getUser(token); // 获取用户信息
    checkedParameter(taskForm, "type", "title", "describe"); // 检测参数
    String formId = getUUID(), uid = user.getId(); // 生成FormData 相关参数
    Map processObject = startProcess(uid, formId); // 启动流程
    FormDataDO formData = saveSuperviseMatterFromData(taskForm,
            processObject, uid, formId); // 保存进入数据库

    // 整理返回数据
    Map variables = new LinkedHashMap();
    variables.put("fromInfo", formData);
    variables.put("processInfo", processObject);

    return variables;
}
 
开发者ID:afterloe,项目名称:bpm-client,代码行数:17,代码来源:SuperviseMatterServiceImpl.java

示例5: testArrayPath

import java.util.LinkedHashMap; //导入依赖的package包/类
/**
 * Test that the ArrayModel can be used to create paths
 */
@Test
public void testArrayPath() throws QueueModelException {
	ScanAtomAssembler scAtAss = new ScanAtomAssembler(null);
	ArrayModel arrayModel = new ArrayModel(new double[]{15.8, 16.5, 15.9, 14.2});
	arrayModel.setName("stage_y");
	CompoundModel<?> cMod = new CompoundModel<>();
	cMod.addData(arrayModel, null);

	/*
	 * Fully specified by template
	 */
	Map<String, DeviceModel> pMods = new LinkedHashMap<>();
	Map<String, Object> devConf = new HashMap<>();
	devConf.put("positions", new Double[]{15.8, 16.5, 15.9, 14.2});
	DeviceModel pathModel = new DeviceModel("Array", devConf);
	pMods.put("stage_y", pathModel);
	ScanAtom scAtMod = new ScanAtom("testScan", pMods, new HashMap<String, DeviceModel>(), new ArrayList<Object>());

	ScanAtom assAt = scAtAss.assemble(scAtMod, new ExperimentConfiguration(null, null, null));
	assertEquals("Template specified path differs from expected", cMod, assAt.getScanReq().getCompoundModel());
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:25,代码来源:ScanAtomAssemblerTest.java

示例6: loadTableBD

import java.util.LinkedHashMap; //导入依赖的package包/类
public void loadTableBD(String dateAuj) {
    Result res = db.execute("MATCH (a:Avion)-[r:Affecter]->(d:Depart)<-[c:Constituer]-(v:Vol) WHERE d.date='"+dateAuj+"' RETURN d.numero, d.date, v.villeDep, v.villeArr,  a.type, a.capacite, v.numero, v.heureDep, v.heureArr");
    DefaultTableModel dtm = new DefaultTableModel(0,0);
    String header[] = {"Numero", "Date","Depart", "Arriveé", "Type", "Capacite", "NumVol", "Heure De Depart", "Heure d'arrive"};
    String test[] = {"d.numero", "d.date","v.villeDep", "v.villeArr", "a.type", "a.capacite", "v.numero", "v.heureDep", "v.heureArr"};
    dtm.setColumnIdentifiers(header);
    jTable1.setModel(dtm);
    while(res.hasNext()) {
        Map<String, Object> row = res.next();
        Map<String, Object> obj = new LinkedHashMap();
        for (String t:test) {
            obj.put(t, null);
        }
        for(Map.Entry<String, Object> col : row.entrySet()) {
             obj.put(col.getKey(),col.getValue());   
        }
        
        dtm.addRow(obj.values().toArray());
}
}
 
开发者ID:ATF19,项目名称:flight-management-system-java,代码行数:21,代码来源:MainWindow.java

示例7: mapCandidates

import java.util.LinkedHashMap; //导入依赖的package包/类
private Map<Symbol, JCDiagnostic> mapCandidates() {
    Map<Symbol, JCDiagnostic> candidates = new LinkedHashMap<Symbol, JCDiagnostic>();
    for (Candidate c : resolveContext.candidates) {
        if (c.isApplicable()) continue;
        candidates.put(c.sym, c.details);
    }
    return candidates;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:Resolve.java

示例8: queryMapKeysMustBeStrings

import java.util.LinkedHashMap; //导入依赖的package包/类
@Test
public void queryMapKeysMustBeStrings() throws Exception {
  server.enqueue(new MockResponse());

  TestInterface api = new TestInterfaceBuilder().target("http://localhost:" + server.getPort());

  Map<Object, String> queryMap = new LinkedHashMap<Object, String>();
  queryMap.put(Integer.valueOf(42), "alice");

  try {
    api.queryMap((Map) queryMap);
    Fail.failBecauseExceptionWasNotThrown(IllegalStateException.class);
  } catch (IllegalStateException ex) {
    assertThat(ex).hasMessage("QueryMap key must be a String: 42");
  }
}
 
开发者ID:wenwu315,项目名称:XXXX,代码行数:17,代码来源:FeignTest.java

示例9: createCandidateSet

import java.util.LinkedHashMap; //导入依赖的package包/类
/**
 * 
 * @param vNet
 * @return The set of substrate candidates for each virtual node of vNet
 */
private Map<VirtualNode, List<SubstrateNode>> createCandidateSet(
		SubstrateNetwork sNet, VirtualNetwork vNet) {
	Map<VirtualNode, List<SubstrateNode>> candidateSet = new LinkedHashMap<VirtualNode, List<SubstrateNode>>();
	List<SubstrateNode> substrateSet;
	for (Iterator<VirtualNode> itt = vNet.getVertices().iterator(); itt
			.hasNext();) {
		substrateSet = new LinkedList<SubstrateNode>();
		VirtualNode currVnode = itt.next();
		if (nodeMapping.containsKey(currVnode)) {
			substrateSet.add(nodeMapping.get(currVnode));
		} else {
			substrateSet.addAll(findFulfillingNodes(sNet, currVnode));
		}
		candidateSet.put(currVnode, substrateSet);
	}
	return candidateSet;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:23,代码来源:CompleteNodeLinkMappingHiddenHop.java

示例10: getCacheEntry

import java.util.LinkedHashMap; //导入依赖的package包/类
/**
 * Get the cache entry for specific nsPath. If the API returns an entry
 * doesn't mean that entry was existing in the Cache because the cache loader
 * would fetch and load a non existing entry on demand upon expiry.
 *
 * @param nsPath message nspath
 * @return cache entry map.
 */
@RequestMapping(value = "/cache/entry", method = GET)
@ResponseBody
public ResponseEntity<Map<String, Object>> getCacheEntry(@RequestParam(value = "nsPath", required = true) String nsPath) {
    Map<String, Object> stat = new LinkedHashMap<>(2);
    List<BasicSubscriber> entry;
    try {
        entry = cache.instance().get(new SinkKey(nsPath));
    } catch (ExecutionException e) {
        stat.put("status", e.getMessage());
        return new ResponseEntity<>(stat, NOT_FOUND);
    }
    stat.put("status", "ok");
    stat.put("entry", entry.toString());
    return new ResponseEntity<>(stat, OK);
}
 
开发者ID:oneops,项目名称:oneops,代码行数:24,代码来源:AntennaWsController.java

示例11: returnIntent

import java.util.LinkedHashMap; //导入依赖的package包/类
private void returnIntent(LinkedHashMap<String, String> commandsList) {
    ArrayList<String> ids = new ArrayList<>();
    ArrayList<String> commands = new ArrayList<>();
    Collections.addAll(ids, commandsList.keySet().toArray(new String[commands.size()]));
    Collections.addAll(commands, commandsList.values().toArray(new String[commands.size()]));
    if (commands.size() > 0) {
        Intent intent = new Intent();
        intent.putExtra(POSITION_INTENT, mProfilePosition);
        intent.putExtra(RESULT_ID_INTENT, ids);
        intent.putExtra(RESULT_COMMAND_INTENT, commands);
        setResult(0, intent);
        finish();
    } else {
        Utils.toast(R.string.no_changes, ProfileActivity.this);
    }
}
 
开发者ID:morogoku,项目名称:MTweaks-KernelAdiutorMOD,代码行数:17,代码来源:ProfileActivity.java

示例12: getClassPathEntries

import java.util.LinkedHashMap; //导入依赖的package包/类
@VisibleForTesting
static ImmutableMap<File, ClassLoader> getClassPathEntries(ClassLoader classloader) {
  LinkedHashMap<File, ClassLoader> entries = Maps.newLinkedHashMap();
  // Search parent first, since it's the order ClassLoader#loadClass() uses.
  ClassLoader parent = classloader.getParent();
  if (parent != null) {
    entries.putAll(getClassPathEntries(parent));
  }
  if (classloader instanceof URLClassLoader) {
    URLClassLoader urlClassLoader = (URLClassLoader) classloader;
    for (URL entry : urlClassLoader.getURLs()) {
      if (entry.getProtocol().equals("file")) {
        File file = toFile(entry);
        if (!entries.containsKey(file)) {
          entries.put(file, classloader);
        }
      }
    }
  }
  return ImmutableMap.copyOf(entries);
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:22,代码来源:ClassPath.java

示例13: toOrder

import java.util.LinkedHashMap; //导入依赖的package包/类
@Action(value="toOrder", results={@Result(name="orderUI", location=ViewLocation.View_ROOT+
		"hotel.jsp")})
public String toOrder() throws Exception{
	//TODO 跳转到选择团购券的页面
	Customer customer = (Customer)session.get(Const.CUSTOMER);
	List<Grouppurchasevoucher> gps = grouppurchasevoucherService.getByCust(customer);
	
	//把数据封装成Map
	Map<Roomtype, List<Grouppurchasevoucher>> rgMap = new LinkedHashMap<Roomtype, List<Grouppurchasevoucher>>();
	for(Grouppurchasevoucher gp : gps){
		if(!rgMap.containsKey(gp.getRoomtype())){
			List<Grouppurchasevoucher> grps = new LinkedList<Grouppurchasevoucher>();
			rgMap.put(gp.getRoomtype(), grps);
		}
		rgMap.get(gp.getRoomtype()).add(gp);
	}
	
	request.setAttribute("rgMap", rgMap);
	
	return "orderUI";
}
 
开发者ID:liuxuanhai,项目名称:WeiXing_xmu-2016-MrCode,代码行数:22,代码来源:IndexAction.java

示例14: getConnectionPropertiesTemplate

import java.util.LinkedHashMap; //导入依赖的package包/类
public Pair<Map<String, List<String>>, Map<String, String>> getConnectionPropertiesTemplate() {
    Map<String, List<String>> template = new LinkedHashMap<String, List<String>>();
    template.put(CONNECT_STRING, Arrays
            .asList(new String[] { defaultHosts }));
    template.put(SESSION_TIMEOUT, Arrays
            .asList(new String[] { defaultTimeout }));
    template.put(DATA_ENCRYPTION_MANAGER, Arrays
            .asList(new String[] { defaultEncryptionManager }));
    template.put(AUTH_SCHEME_KEY, Arrays
            .asList(new String[] { defaultAuthScheme }));
    template.put(AUTH_DATA_KEY, Arrays
            .asList(new String[] { defaultAuthValue }));
    Map<String, String> labels = new LinkedHashMap<String, String>();
    labels.put(CONNECT_STRING, "Connect String");
    labels.put(SESSION_TIMEOUT, "Session Timeout");
    labels.put(DATA_ENCRYPTION_MANAGER, "Data Encryption Manager");
    labels.put(AUTH_SCHEME_KEY, "Authentication Scheme");
    labels.put(AUTH_DATA_KEY, "Authentication Data");
    return new Pair<Map<String, List<String>>, Map<String, String>>(
            template, labels);
}
 
开发者ID:l294265421,项目名称:ZooKeeper,代码行数:22,代码来源:ZooInspectorManagerImpl.java

示例15: getKey2Desc

import java.util.LinkedHashMap; //导入依赖的package包/类
private synchronized Map<String, Description> getKey2Desc(final Object fo) {
    Map<String, Description> result = fo2Key2Desc.get(fo);
    
    if (result == null) {
        files.add(new CleanableWeakReference<Object>(fo));
        fo2Key2Desc.put(fo, result = Collections.synchronizedMap(new LinkedHashMap<String, Description>()));
        pcs.firePropertyChange("fos", null, fo);
        
        if (fo instanceof FileObject) {
            ((FileObject)fo).addFileChangeListener(new FileChangeAdapter() {
                @Override
                public void fileDeleted(FileEvent ev) {
                    fileDeletedSync(ev, (FileObject)fo);
                }
            });
        }
    }
    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:TimesCollectorPeer.java


注:本文中的java.util.LinkedHashMap类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。