當前位置: 首頁>>代碼示例>>Java>>正文


Java HashedMap.put方法代碼示例

本文整理匯總了Java中org.apache.commons.collections.map.HashedMap.put方法的典型用法代碼示例。如果您正苦於以下問題:Java HashedMap.put方法的具體用法?Java HashedMap.put怎麽用?Java HashedMap.put使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.collections.map.HashedMap的用法示例。


在下文中一共展示了HashedMap.put方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getuserPrefs

import org.apache.commons.collections.map.HashedMap; //導入方法依賴的package包/類
@ModelAttribute("userPrefs")
public HashedMap getuserPrefs() {
	Authentication auth = SecurityContextHolder.getContext().getAuthentication();
	String eppn = auth.getName();
	HashedMap mapPrefs= new HashedMap();
   	mapPrefs.put("editable", preferencesService.getPrefValue(eppn, "EDITABLE"));
   	mapPrefs.put("ownOrFreeCard", preferencesService.getPrefValue(eppn, "OWNORFREECARD"));
	return mapPrefs;
}
 
開發者ID:EsupPortail,項目名稱:esup-sgc,代碼行數:10,代碼來源:ManagerCardController.java

示例2: index

import org.apache.commons.collections.map.HashedMap; //導入方法依賴的package包/類
/***
 * 歡迎頁麵
 * @param request
 * @return json
 */
@ResponseBody
@RequestMapping(value = {"", "/index"})
public Object index(HttpServletRequest request) {
    log.error("hello world");
    HashedMap map = new HashedMap();
    map.put("hashCode", this.hashCode());
    map.put("thread", Thread.currentThread().getName());
    map.put("msg", "welcome message");
    Person person = new Person("xjt", 2, 22);
    map.put("author", person);
    return map;
}
 
開發者ID:ansafari,項目名稱:melon,代碼行數:18,代碼來源:IndexController.java

示例3: saveWith4Images

import org.apache.commons.collections.map.HashedMap; //導入方法依賴的package包/類
@Transactional
@Deprecated
public void saveWith4Images(String name, Boolean isCrop, Boolean isPlague,
		String scientificName, String desc, String im1, String base64_1,
		String im2, String base64_2, String im3, String base64_3,
		String im4, String base64_4) {
	
	HashedMap images = new HashedMap(); 
	images.put(im1, base64_1);
	images.put(im2, base64_2);
	images.put(im3, base64_3);
	images.put(im3, base64_4);
	
	saveWithNImages(name, isCrop, isPlague, scientificName, desc, images);
}
 
開發者ID:eiroa,項目名稱:Fitoscanner_Backend,代碼行數:16,代碼來源:EspecieService.java

示例4: saveSample

import org.apache.commons.collections.map.HashedMap; //導入方法依賴的package包/類
@POST
@Path("/save/{quant}")
@Consumes("application/x-www-form-urlencoded")
public Response saveSample(@PathParam("quant")Integer quantity  ,
		MultivaluedMap<String, String> FormValues,
		@FormParam("date") String date,
		@FormParam("isAnon")Boolean isAnon,
		@FormParam("imei")String imei,
		@FormParam("lat")String lat,
		@FormParam("lon")String lon,
		@FormParam("images_hash")String hash) {
	DateTime parsedDate = DateHelper.formatStringDate(date);
	System.out.println("Se intentara guardar muestra de "+quantity+ " imagenes");
	
	HashedMap imagenes = new HashedMap();
	int total = quantity;
	while(total >0){
		if(!FormValues.containsKey("sample_image_"+total+"_base64")){
			//http 417 Expectation failed
			return Response.status(417)
					.header("Access-Control-Allow-Origin", "*")
					.header("There are sample images missing","*")
					.build();
		}
		
		//Armar mapa titulo =>base64
		imagenes.put(FormValues.getFirst("sample_image_"+total+"_title"), FormValues.getFirst("sample_image_"+total+"_base64"));
		total--;
	}
	System.out.println("Imagenes obtenidas: "+ imagenes);
	
	muestraService.saveSample(parsedDate,isAnon,imei,lat,lon,
			FormValues.getFirst("sample_name"), imagenes,hash);
	return Response.ok().header("Access-Control-Allow-Origin", "*").build();
}
 
開發者ID:eiroa,項目名稱:Fitoscanner_Backend,代碼行數:36,代碼來源:MuestraRest.java

示例5: cacheAllGenes

import org.apache.commons.collections.map.HashedMap; //導入方法依賴的package包/類
private static void cacheAllGenes() {
    Long current = MainUtils.getCurrentTimestamp();

    genes = new HashSet<>(ApplicationContextSingleton.getGeneBo().findAll());
    genesByEntrezId = new HashedMap();
    hugoSymbolToEntrez = new HashedMap();
    for (Gene gene : genes) {
        genesByEntrezId.put(gene.getEntrezGeneId(), gene);
        hugoSymbolToEntrez.put(gene.getHugoSymbol(), gene.getEntrezGeneId());
    }

    System.out.println("Cache all genes: " + MainUtils.getTimestampDiff(current) + " at " + MainUtils.getCurrentTime());
}
 
開發者ID:oncokb,項目名稱:oncokb,代碼行數:14,代碼來源:CacheUtils.java

示例6: getFields

import org.apache.commons.collections.map.HashedMap; //導入方法依賴的package包/類
public Map<String, Object> getFields() {
    HashedMap fields = new HashedMap();
    fields.put("s3_bucket", s3Bucket);
    fields.put("s3_object_key", s3ObjectKey);
    return fields;
}
 
開發者ID:sherzberg,項目名稱:graylog-plugin-s3,代碼行數:7,代碼來源:S3Record.java

示例7: simple

import org.apache.commons.collections.map.HashedMap; //導入方法依賴的package包/類
@Test
public void simple() throws InterruptedException {
	CachedMap<Object, Object> cachedMap = new CachedMap<>(1000);

	cachedMap.put("sample", "zz");
	cachedMap.put("sample22", "zz");

	System.out.println(cachedMap.get("sample"));

	Thread.sleep(1500);

	System.out.println(cachedMap.get("sample"));
	System.out.println(cachedMap.get("sample22"));

	HashedMap hashedMap = new HashedMap();
	hashedMap.put("sample", "zz");
	hashedMap.put("sample22", "zz");

	cachedMap.putAll(hashedMap);

	System.out.println(cachedMap);
	Thread.sleep(1500);

	System.out.println(cachedMap);

}
 
開發者ID:callakrsos,項目名稱:Gargoyle,代碼行數:27,代碼來源:CachedMapTest.java

示例8: miltiThread

import org.apache.commons.collections.map.HashedMap; //導入方法依賴的package包/類
@Test
public void miltiThread() throws InterruptedException {

	for (int i = 0; i < 10; i++) {
		final int inn = i;
		Thread thread = new Thread(() -> {

			String name = Thread.currentThread().getName();
			CachedMap<Object, Object> cachedMap = new CachedMap<>(1000);

			cachedMap.put("sample", "zz" + inn);
			cachedMap.put("sample22", "zz" + inn);

			System.out.println(name + " " + cachedMap.get("sample"));

			try {
				Thread.sleep(1500);
			} catch (Exception e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}

			System.out.println(name + " " + cachedMap.get("sample"));
			System.out.println(name + " " + cachedMap.get("sample22"));

			HashedMap hashedMap = new HashedMap();
			hashedMap.put("sample", "zz" + inn);
			hashedMap.put("sample22", "zz" + inn);

			cachedMap.putAll(hashedMap);

			System.out.println(name + " " + cachedMap);
			try {
				Thread.sleep(1500);
			} catch (Exception e) {
				e.printStackTrace();
			}

			System.out.println(name + " " + cachedMap);
		} , "Name" + i);

		thread.start();
	}

	Thread.currentThread().sleep(5000);
}
 
開發者ID:callakrsos,項目名稱:Gargoyle,代碼行數:47,代碼來源:CachedMapTest.java

示例9: miltiThread2

import org.apache.commons.collections.map.HashedMap; //導入方法依賴的package包/類
@Test
	public void miltiThread2() throws InterruptedException {

		CachedMap<Object, Object> cachedMap = new CachedMap<>(1000);
		for (int i = 0; i < 10; i++) {
			final int inn = i;
			Thread thread = new Thread(() -> {

				String name = Thread.currentThread().getName();

//				cachedMap.put(name, "zz" + inn);
				cachedMap.put(name, "zz" + inn);
				cachedMap.put(name, "zz" + inn);
				cachedMap.put(name, "zz" + inn);
				cachedMap.put(name, "zz" + inn);
				cachedMap.put(name, "zz" + inn);

				System.out.println(name + " " + cachedMap.get(name));

				try {
					Thread.sleep(1500);
				} catch (Exception e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}

				System.out.println(name + " " + cachedMap.get(name));


				HashedMap hashedMap = new HashedMap();
				hashedMap.put(name, "zz" + inn);

				cachedMap.putAll(hashedMap);

				System.out.println(name + " " + cachedMap);
				try {
					Thread.sleep(1500);
				} catch (Exception e) {
					e.printStackTrace();
				}

				System.out.println(name + " " + cachedMap);
			} , "Name" + i);

			thread.start();
		}

		System.out.println(cachedMap.isEmpty());
		Thread.currentThread().sleep(5000);
		System.out.println(cachedMap.isEmpty());
	}
 
開發者ID:callakrsos,項目名稱:Gargoyle,代碼行數:52,代碼來源:CachedMapTest.java


注:本文中的org.apache.commons.collections.map.HashedMap.put方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。