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


Java LinkedHashMap.keySet方法代碼示例

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


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

示例1: iterateLinkedHashMap

import java.util.LinkedHashMap; //導入方法依賴的package包/類
private static void iterateLinkedHashMap(LinkedHashMap<String, Object> map) {
	for (String key : map.keySet()) {
		Object value = map.get(key);
		if (value instanceof LinkedHashMap) {
			iterateLinkedHashMap((LinkedHashMap<String, Object>) value);
		}
		else {
			if (toBeSanitized(key)) {
				map.put(key, REDACTION_STRING);
			}
		}
	}
}
 
開發者ID:spring-cloud,項目名稱:spring-cloud-skipper,代碼行數:14,代碼來源:ArgumentSanitizer.java

示例2: getParameterFromResult

import java.util.LinkedHashMap; //導入方法依賴的package包/類
/**
 * Get the result from the specified generator
 * 
 * @param generatorName
 * @return
 */
private Object getParameterFromResult(String generatorName, LinkedHashMap<String, Object> genResults) {
	for(String s : genResults.keySet()) {
		if(s.equals(generatorName)) {
			return genResults.get(s);
		}
	}
	throw new Error("There are no results for the "+generatorName);
}
 
開發者ID:KeepTheBeats,項目名稱:alevin-svn2,代碼行數:15,代碼來源:TestRunner.java

示例3: savePropertiesInComponentModel

import java.util.LinkedHashMap; //導入方法依賴的package包/類
private void savePropertiesInComponentModel(AbstractWidget eltWidget,LinkedHashMap<String, Object> properties) {
	LinkedHashMap<String, Object> tempPropert = properties;
	LinkedHashMap<String, Object> componentConfigurationProperties = componentProperties.getComponentConfigurationProperties();
	for(String propName : tempPropert.keySet()){
		componentConfigurationProperties.put(propName, tempPropert.get(propName));
	}
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:8,代碼來源:PropertyDialog.java

示例4: main

import java.util.LinkedHashMap; //導入方法依賴的package包/類
public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    LinkedHashMap<String, String> numbers = new LinkedHashMap<>();
    StringBuilder text = new StringBuilder();
    String line = scan.nextLine();
    while(!line.equals("END")){
        text.append(line);
        line = scan.nextLine();
    }

    Matcher matcher = Pattern.compile(pairsRegex).matcher(text);
    while (matcher.find()){
        numbers.put(
                matcher.group("name").toString(),
                matcher.group("num").replaceAll("[^+\\d]",""));
    }
    if(numbers.size() == 0) {
        System.out.println("<p>No matches!</p>");
        return;
    }
    System.out.print("<ol>");
    for (String name :
            numbers.keySet()) {
        System.out.printf("<li><b>%s:</b> %s</li>", name, numbers.get(name));
    }
    System.out.print("</ol>");
}
 
開發者ID:kostovhg,項目名稱:SoftUni,代碼行數:28,代碼來源:p09_PhoneNumbers.java

示例5: initAvgScorePlot

import java.util.LinkedHashMap; //導入方法依賴的package包/類
private void initAvgScorePlot() {
    LinkedHashMap<Integer, Double> monthsNPoems = stats.getMonthAvgScore();
    ArrayList<Number> xs = new ArrayList<>();
    ArrayList<Number> ys = new ArrayList<>();
    for (int key : monthsNPoems.keySet()) {
        xs.add(key);
        ys.add(monthsNPoems.get(key));
    }
    activity.addAvgScorePlotData(xs, ys);
}
 
開發者ID:PaulKlinger,項目名稱:Sprog-App,代碼行數:11,代碼來源:StatsPresenter.java

示例6: setPatternList

import java.util.LinkedHashMap; //導入方法依賴的package包/類
public void setPatternList (LinkedHashMap<byte[],byte[]> pl) {
	patternList = pl;
	patternIndx = 0;
	allKeys = pl.keySet();
	allKeys.forEach( (k) -> 
	{ 
		if (k.length > maxPatternLen) maxPatternLen = k.length;
		byte[] val = pl.get(k);
		if (val != null && val.length > maxRcLen) maxRcLen = val.length;
	});
	//System.out.println("max pattern len = "+maxPatternLen+", max rc len = "+maxRcLen);
}
 
開發者ID:SoftwareAG,項目名稱:webmethods-integrationserver-largefile,代碼行數:13,代碼來源:Nio.java

示例7: putProfile

import java.util.LinkedHashMap; //導入方法依賴的package包/類
public void putProfile(String name, LinkedHashMap<String, String> commands) {
    try {
        JSONObject items = new JSONObject();
        items.put("name", name);

        ProfileItem profileItem = new ProfileItem(items);
        for (String id : commands.keySet()) {
            profileItem.putCommand(new ProfileItem.CommandItem(id, commands.get(id)));
        }

        putItem(items);
    } catch (JSONException e) {
        e.printStackTrace();
    }
}
 
開發者ID:morogoku,項目名稱:MTweaks-KernelAdiutorMOD,代碼行數:16,代碼來源:Profiles.java

示例8: sortHashMapByValues

import java.util.LinkedHashMap; //導入方法依賴的package包/類
/**
 * Sorts LinkedHashMap by its values(natural descending order). keeps the
 * duplicates as it is.
 *
 * @param passedMap
 *          An Object of type LinkedHashMap to be sorted by its values.
 * @return An Object containing the sorted LinkedHashMap.
 */
private LinkedHashMap<?,?> sortHashMapByValues(LinkedHashMap<String,String> passedMap) {
  List<String> mapKeys = new ArrayList<String>(passedMap.keySet());
  List<String> mapValues = new ArrayList<String>(passedMap.values());

  Collections.sort(mapValues, new ValueComparator());
  Collections.sort(mapKeys);
  // Reversing the collection to sort the values in descending order
  Collections.reverse(mapValues);
  LinkedHashMap<String,String> sortedMap = new LinkedHashMap<String,String>();

  Iterator<String> valueIt = mapValues.iterator();
  while (valueIt.hasNext()) {
    String val = valueIt.next();
    Iterator<String> keyIt = mapKeys.iterator();
    while (keyIt.hasNext()) {
      String key = keyIt.next();
      String comp1 = passedMap.get(key).toString();
      String comp2 = val.toString();

      if (comp1.equals(comp2)) {
        passedMap.remove(key);
        mapKeys.remove(key);
        sortedMap.put(key, val);
        break;
      }
    }
  }
  return sortedMap;
}
 
開發者ID:GateNLP,項目名稱:gate-core,代碼行數:38,代碼來源:DocTimeReporter.java

示例9: handleImage

import java.util.LinkedHashMap; //導入方法依賴的package包/類
@Override
public void handleImage(Canvas canvas, Matrix m) {
    LinkedHashMap<Integer, StickerItem> addItems = mStickerView.getBank();
    for (Integer id : addItems.keySet()) {
        StickerItem item = addItems.get(id);
        item.matrix.postConcat(m);// 乘以底部圖片變化矩陣
        canvas.drawBitmap(item.bitmap, item.matrix, null);
    }// end for
}
 
開發者ID:viseator,項目名稱:MontageCam,代碼行數:10,代碼來源:StickerFragment.java

示例10: setUpMap

import java.util.LinkedHashMap; //導入方法依賴的package包/類
private void setUpMap()
{
    LatLng localLatLng = new LatLng(41.104889999999997D, 29.027756D);
    this.mMap.moveCamera(CameraUpdateFactory.newLatLng(localLatLng));
    this.mMap.animateCamera(CameraUpdateFactory.zoomTo(15.0F));
    if (this.mMap == null)
        this.mMap = ((MapFragment)getFragmentManager().findFragmentById(R.id.map)).getMap();
    if (this.mMap != null)
    {
        this.ituArea = new PolygonOptions().add(new LatLng(41.106655000000003D, 29.014520999999998D)).add(new LatLng(41.108691999999998D, 29.021429999999999D)).add(new LatLng(41.108967D, 29.029983999999999D)).add(new LatLng(41.111206000000003D, 29.037043000000001D)).add(new LatLng(41.099578999999999D, 29.038195999999999D)).add(new LatLng(41.097768000000002D, 29.022210000000001D)).add(new LatLng(41.106655000000003D, 29.014520999999998D)).strokeWidth(5.0F).strokeColor(-16776961).geodesic(true);
        this.mMap.addPolygon(ituArea);

        final LinkedHashMap<PolygonOptions,Pair> densityMap = new LinkedHashMap<PolygonOptions,Pair>();

        densityMap.put( new PolygonOptions().add(new LatLng(41.104940, 29.017533)).add(new LatLng(41.105251, 29.019770)).add(new LatLng(41.104369, 29.019925)).add(new LatLng(41.104232, 29.019303)).add(new LatLng(41.103755, 29.019378)).add(new LatLng(41.103545, 29.017833)).add(new LatLng(41.104940, 29.017533)).strokeWidth(3.0F).strokeColor(Color.BLACK).geodesic(true).clickable(true), Pair.create("İnşaat Fakültesi",0));
        densityMap.put( new PolygonOptions().add(new LatLng(41.104290, 29.020028)).add(new LatLng(41.104482, 29.021505)).add(new LatLng(41.103404, 29.021770)).add(new LatLng(41.103198, 29.020281)).add(new LatLng(41.104290, 29.020028)).strokeWidth(3.0F).strokeColor(Color.BLACK).geodesic(true).clickable(true), Pair.create("Kütüphane",0));
        densityMap.put( new PolygonOptions().add(new LatLng(41.104492, 29.021625)).add(new LatLng(41.104617, 29.022429)).add(new LatLng(41.103101, 29.022772)).add(new LatLng(41.102972, 29.021989)).add(new LatLng(41.104492, 29.021625)).strokeWidth(3.0F).strokeColor(Color.BLACK).geodesic(true).clickable(true), Pair.create("Yemekhane",0));
        densityMap.put( new PolygonOptions().add(new LatLng(41.102416, 29.020708)).add(new LatLng(41.102525, 29.021996)).add(new LatLng(41.101854, 29.022152)).add(new LatLng(41.101708, 29.021009)).add(new LatLng(41.101833, 29.020564)).add(new LatLng(41.102266, 29.020559)).add(new LatLng(41.102416, 29.020708)).strokeWidth(3.0F).strokeColor(Color.BLACK).geodesic(true).clickable(true), Pair.create("Uçak Uzay Bilimleri Fakültesi",0));
        densityMap.put( new PolygonOptions().add(new LatLng(41.102101, 29.022205)).add(new LatLng(41.102150, 29.022392)).add(new LatLng(41.102461, 29.023051)).add(new LatLng(41.102352, 29.023931)).add(new LatLng(41.100989, 29.024323)).add(new LatLng(41.100447, 29.023774)).add(new LatLng(41.100500, 29.022583)).add(new LatLng(41.102101, 29.022205)).strokeWidth(3.0F).strokeColor(Color.BLACK).geodesic(true).clickable(true), Pair.create("Stadyum",0));
        densityMap.put( new PolygonOptions().add(new LatLng(41.104662, 29.023917)).add(new LatLng(41.104812, 29.025129)).add(new LatLng(41.104311, 29.025258)).add(new LatLng(41.104174, 29.024094)).add(new LatLng(41.104662, 29.023917)).strokeWidth(3.0F).strokeColor(Color.BLACK).geodesic(true).clickable(true), Pair.create("Elektrik Elektronik Fakültesi",0));
        densityMap.put( new PolygonOptions().add(new LatLng(41.104128, 29.024062)).add(new LatLng(41.104279, 29.025306)).add(new LatLng(41.103572, 29.025451)).add(new LatLng(41.103394, 29.024217)).add(new LatLng(41.104128, 29.024062)).strokeWidth(3.0F).strokeColor(Color.BLACK).geodesic(true).clickable(true), Pair.create("Bilgisayar ve Bilişim Fakültesi",0));
        densityMap.put( new PolygonOptions().add(new LatLng(41.104848, 29.025299)).add(new LatLng(41.105025, 29.026757)).add(new LatLng(41.104269, 29.026891)).add(new LatLng(41.104172, 29.026542)).add(new LatLng(41.103586, 29.026698)).add(new LatLng(41.103513, 29.026381)).add(new LatLng(41.104144, 29.026209)).add(new LatLng(41.104087, 29.025533)).add(new LatLng(41.104848, 29.025299)).strokeWidth(3.0F).strokeColor(Color.BLACK).geodesic(true).clickable(true), Pair.create("Maden Fakültesi",0));
        densityMap.put( new PolygonOptions().add(new LatLng(41.104521, 29.026871)).add(new LatLng(41.104606, 29.027906)).add(new LatLng(41.103377, 29.028174)).add(new LatLng(41.103231, 29.027133)).add(new LatLng(41.104521, 29.026871)).strokeWidth(3.0F).strokeColor(Color.BLACK).geodesic(true).clickable(true), Pair.create("Kimya Metalurji Fakültesi",0));
        densityMap.put( new PolygonOptions().add(new LatLng(41.105643, 29.022831)).add(new LatLng(41.105805, 29.024298)).add(new LatLng(41.104976, 29.024491)).add(new LatLng(41.104794, 29.023013)).add(new LatLng(41.105643, 29.022831)).strokeWidth(3.0F).strokeColor(Color.BLACK).geodesic(true).clickable(true), Pair.create("Merkezi Derslik Binası",0));
        densityMap.put( new PolygonOptions().add(new LatLng(41.107237, 29.022601)).add(new LatLng(41.107342, 29.023416)).add(new LatLng(41.106869, 29.023491)).add(new LatLng(41.106756, 29.022724)).add(new LatLng(41.107237, 29.022601)).strokeWidth(3.0F).strokeColor(Color.BLACK).geodesic(true).clickable(true), Pair.create("Süleyman Demirel Kültür Merkezi",0));
        densityMap.put( new PolygonOptions().add(new LatLng(41.107188, 29.023894)).add(new LatLng(41.107248, 29.024297)).add(new LatLng(41.106904, 29.024388)).add(new LatLng(41.107106, 29.025777)).add(new LatLng(41.106633, 29.025938)).add(new LatLng(41.106649, 29.026367)).add(new LatLng(41.106394, 29.026426)).add(new LatLng(41.106135, 29.024200)).add(new LatLng(41.107188, 29.023894)).strokeWidth(3.0F).strokeColor(Color.BLACK).geodesic(true).clickable(true), Pair.create("Fen Edebiyat Fakültesi",0));
        densityMap.put( new PolygonOptions().add(new LatLng(41.102853, 29.026462)).add(new LatLng(41.103043, 29.028095)).add(new LatLng(41.102242, 29.028298)).add(new LatLng(41.102044, 29.026680)).add(new LatLng(41.102853, 29.026462)).strokeWidth(3.0F).strokeColor(Color.BLACK).geodesic(true).clickable(true), Pair.create("Gemi İnşaatı ve Deniz Bilimleri Fakültesi",0));
        densityMap.put( new PolygonOptions().add(new LatLng(41.107821, 29.021052)).add(new LatLng(41.107853, 29.021733)).add(new LatLng(41.107461, 29.021803)).add(new LatLng(41.107380, 29.021347)).add(new LatLng(41.107158, 29.021315)).add(new LatLng(41.107085, 29.021133)).add(new LatLng(41.107821, 29.021052)).strokeWidth(3.0F).strokeColor(Color.BLACK).geodesic(true).clickable(true), Pair.create("Rektörlük",0));
        List<PolygonOptions> arr = new ArrayList(densityMap.keySet());
        for(PolygonOptions x: arr)
            this.mMap.addPolygon(x);
    }
}
 
開發者ID:sarikaya,項目名稱:Bee-Analyzer,代碼行數:34,代碼來源:MapsActivity.java

示例11: addGroupsInTab

import java.util.LinkedHashMap; //導入方法依賴的package包/類
private void addGroupsInTab(
		ScrolledCompositeHolder scrolledCompositeHolder,
		LinkedHashMap<String, ArrayList<Property>> subgroupTree) {
	for(String subgroupName: subgroupTree.keySet()){
		Property property = subgroupTree.get(subgroupName).get(0);
		AbstractELTContainerWidget subGroupContainer = getGroupWidgetContainer(
				scrolledCompositeHolder, subgroupName, property);			
		addCustomWidgetsToGroupWidget(subgroupTree, subgroupName,
				subGroupContainer);			
	}
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:12,代碼來源:PropertyDialogBuilder.java

示例12: attachToPropertySubGroup

import java.util.LinkedHashMap; //導入方法依賴的package包/類
@Override
public void attachToPropertySubGroup(AbstractELTContainerWidget container) {
	
	ELTDefaultSubgroupComposite eltSuDefaultSubgroupComposite = new ELTDefaultSubgroupComposite(
			container.getContainerControl());
	eltSuDefaultSubgroupComposite.createContainerWidget();

	LinkedHashMap<String, Object> map = allComponenetProperties.getComponentConfigurationProperties();
	for (String key : map.keySet()) {
		if (key.equalsIgnoreCase("inPortCount")) {
			String data = (String) map.get(key);
			if (Integer.parseInt(data) >= 2) {
				value = Integer.parseInt(data);
			} else {
				value = 2;
			}
		}
	}

	AbstractELTWidget eltDefaultLable = new ELTDefaultLable("Join\nConfiguration");
	eltSuDefaultSubgroupComposite.attachWidget(eltDefaultLable);

	setPropertyHelpWidget((Control) eltDefaultLable.getSWTWidgetControl());
	
	final AbstractELTWidget eltDefaultButton;
	if(OSValidator.isMac()){
		eltDefaultButton = new ELTDefaultButton("Edit").buttonWidth(120);
	}else{
		eltDefaultButton = new ELTDefaultButton("Edit");
	}
	eltSuDefaultSubgroupComposite.attachWidget(eltDefaultButton);
	((Button) eltDefaultButton.getSWTWidgetControl()).addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			ELTJoinConfigGrid eltJoinConfigGrid = new ELTJoinConfigGrid(((Button) eltDefaultButton
					.getSWTWidgetControl()).getShell(), propertyDialogButtonBar, configProperty,getComponent());
			ELTJoinMapWidget  joinMapWidget = null;
			for(AbstractWidget abstractWidget:widgets)
			{
				if(abstractWidget instanceof ELTJoinMapWidget)
				{
					joinMapWidget=(ELTJoinMapWidget)abstractWidget;
					break;
				}
			}
			if (joinMapWidget != null) {
				JoinMappingGrid joinMappingGrid = (JoinMappingGrid) joinMapWidget.getProperties()
						.get("join_mapping");
				eltJoinConfigGrid.setSourceFieldList(joinMappingGrid.getLookupInputProperties());
			}
			eltJoinConfigGrid.setPropagatedFieldProperty(SchemaPropagationHelper.INSTANCE
					.getFieldsForFilterWidget(getComponent()));
			eltJoinConfigGrid.open();
			showHideErrorSymbol(widgets);
			
		}

	});
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:60,代碼來源:ELTJoinWidget.java

示例13: saveList

import java.util.LinkedHashMap; //導入方法依賴的package包/類
/**保存列表
 * @param clazz 類
 * @param group 分組
 * @param map 數據表
 * @param start 存儲起始位置,[start, start + map.size()]中原有的將被替換. start = start < 0 ? idList.size() : start;
 * @param pageSize 每頁大小
 */
public <T> void saveList(Class<T> clazz, String group, LinkedHashMap<String, T> map, int start, int pageSize) {
	Log.i(TAG, "\n\n <<<<<<<<<<<<<<<<<\nsaveList  group = " + group + "; start = " + start + "; pageSize = " + pageSize);
	if (clazz == null || map == null || map.size() <= 0) {
		Log.e(TAG, "saveList  clazz == null || map == null || map.size() <= 0 >> return;");
		return;
	}
	final String CLASS_PATH = getClassPath(clazz);

	if (StringUtil.isNotEmpty(group, true)) {
		group = StringUtil.getTrimedString(group);

		Log.i(TAG, "saveList  group = " + group + "; map.size() = " + map.size()
				+ "; start = " + start +"; pageSize = " + pageSize);
		List<String> newIdList = new ArrayList<String>(map.keySet());//用String而不是Long,因為訂單Order的id超出Long的最大值

		Log.i(TAG, "saveList newIdList.size() = " + newIdList.size() + "; start save <<<<<<<<<<<<<<<<<\n ");


		//保存至分組<<<<<<<<<<<<<<<<<<<<<<<<<
		SharedPreferences sp = getSharedPreferences(CLASS_PATH + KEY_GROUP);
		//			sp.edit().putString(KEY_GROUP, group);
		Editor editor = sp.edit();

		Log.i(TAG, "\n saveList pageSize = " + pageSize + " <<<<<<<<");
		//列表每頁大小
		if (pageSize > 0) {
			if (pageSize > MAX_PAGE_SIZE) {
				pageSize = MAX_PAGE_SIZE;
			}
		}
		Log.i(TAG, "\n saveList pageSize = " + pageSize + ">>>>>>>>>");

		//id列表
		List<String> idList = JSON.parseArray(sp.getString(group, null), String.class);
		if (idList == null) {
			idList = new ArrayList<String>();
		}
		if (start < 0) {
			start = idList.size();
		}
		Log.i(TAG, "\n saveList idList.size() = " + idList.size() + " <<<<<<<<");
		String id;
		for (int i = start; i < start + newIdList.size(); i++) {
			id = newIdList.get(i - start);
			if (id == null || id.isEmpty()) {
				continue;
			}
			if (idList.contains(id)) {
				idList.remove(id);//位置發生變化
			}
			if (i < idList.size()) {
				idList.set(i, id);
			} else { 
				idList.add(id);
			}
		}
		editor.remove(group).putString(group, JSON.toJSONString(idList)).commit();

		Log.i(TAG, "\n saveList idList.size() = " + idList.size() + " >>>>>>>>");
	}

	//保存至分組>>>>>>>>>>>>>>>>>>>>>>>>>



	//保存所有數據<<<<<<<<<<<<<<<<<<<<<<<<<
	Cache<T> cache = new Cache<T>(clazz, context, CLASS_PATH + KEY_LIST);
	cache.saveList(map);
	//保存所有數據>>>>>>>>>>>>>>>>>>>>>>>>>

	Log.i(TAG, "saveList cache.getSize() = " + cache.getSize() + "; end save \n>>>>>>>>>>>>>>>>>> \n\n");
	//		}

}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:82,代碼來源:CacheManager.java

示例14: saveList

import java.util.LinkedHashMap; //導入方法依賴的package包/類
/**保存列表
 * @param clazz 類
 * @param group 分組
 * @param map 數據表
 * @param start 存儲起始位置,[start, start + map.size()]中原有的將被替換. start = start < 0 ? idList.size() : start;
 * @param pageSize 每頁大小
 */
public <T> void saveList(Class<T> clazz, String group, LinkedHashMap<String, T> map, int start, int pageSize) {
	Log.i(TAG, "\n\n <<<<<<<<<<<<<<<<<\nsaveList  group = " + group + "; start = " + start + "; pageSize = " + pageSize);
	if (clazz == null || map == null || map.size() <= 0) {
		Log.e(TAG, "saveList  clazz == null || map == null || map.size() <= 0 >> return;");
		return;
	}
	final String CLASS_PATH = getClassPath(clazz);

	if (StringUtil.isNotEmpty(group, true)) {
		group = StringUtil.getTrimedString(group);

		Log.i(TAG, "saveList  group = " + group + "; map.size() = " + map.size()
				+ "; start = " + start +"; pageSize = " + pageSize);
		List<String> newIdList = new ArrayList<String>(map.keySet());//用String而不是Long,因為訂單Order的id超出Long的最大值

		Log.i(TAG, "saveList newIdList.size() = " + newIdList.size() + "; start save <<<<<<<<<<<<<<<<<\n ");


		//保存至分組<<<<<<<<<<<<<<<<<<<<<<<<<
		SharedPreferences sp = getSharedPreferences(CLASS_PATH + KEY_GROUP);
		//			sp.edit().putString(KEY_GROUP, group);
		Editor editor = sp.edit();

		Log.i(TAG, "\n saveList pageSize = " + pageSize + " <<<<<<<<");
		//列表每頁大小
		if (pageSize > 0) {
			if (pageSize > MAX_PAGE_SIZE) {
				pageSize = MAX_PAGE_SIZE;
			}
		}
		Log.i(TAG, "\n saveList pageSize = " + pageSize + ">>>>>>>>>");

		//id列表
		List<String> idList = JSON.parseArray(sp.getString(group, null), String.class);
		if (idList == null) {
			idList = new ArrayList<String>();
		}
		if (start < 0) {
			start = idList.size();
		}
		Log.i(TAG, "\n saveList idList.size() = " + idList.size() + " <<<<<<<<");
		String id;
		for (int i = start; i < start + newIdList.size(); i++) {
			id = newIdList.get(i - start);
			if (id == null || id.isEmpty()) {
				continue;
			}
			if (idList.contains(id)) {
				idList.remove(id);//位置發生變化
			}
			if (i < idList.size()) {
				idList.set(i, id);
			} else { 
				idList.add(id);
			}
		}
		editor.remove(group).putString(group, JSON.toJSONString(idList)).commit();

		Log.i(TAG, "\n saveList idList.size() = " + idList.size() + " >>>>>>>>");
	}

	//保存至分組>>>>>>>>>>>>>>>>>>>>>>>>>



	//保存所有數據<<<<<<<<<<<<<<<<<<<<<<<<<
	Cache<T> cache = new Cache<T>(context, clazz, CLASS_PATH + KEY_LIST);
	cache.saveList(map);
	//保存所有數據>>>>>>>>>>>>>>>>>>>>>>>>>

	Log.i(TAG, "saveList cache.getSize() = " + cache.getSize() + "; end save \n>>>>>>>>>>>>>>>>>> \n\n");
	//		}

}
 
開發者ID:TommyLemon,項目名稱:APIJSON-Android-RxJava,代碼行數:82,代碼來源:CacheManager.java

示例15: checkNexusFile

import java.util.LinkedHashMap; //導入方法依賴的package包/類
private void checkNexusFile(IRunnableDevice<ScanModel> scanner) throws Exception {
	final ScanModel scanModel = ((AbstractRunnableDevice<ScanModel>) scanner).getModel();
	assertEquals(DeviceState.ARMED, scanner.getDeviceState());

	NXroot rootNode = getNexusRoot(scanner);
	NXentry entry = rootNode.getEntry();
	NXinstrument instrument = entry.getInstrument();

	assertSolsticeScanGroup(entry, false, false);

	LinkedHashMap<String, List<String>> signalFieldAxes = new LinkedHashMap<>();
	// axis for additional dimensions of a datafield, e.g. image
	signalFieldAxes.put(NXdetector.NX_DATA, Arrays.asList("real", "imaginary"));
	signalFieldAxes.put("spectrum", Arrays.asList("spectrum_axis"));
	signalFieldAxes.put("value", Collections.emptyList());

	String detectorName = scanModel.getDetectors().get(0).getName();
	NXdetector detector = instrument.getDetector(detectorName);
	// map of detector data field to name of nxData group where that field is the @signal field
	Map<String, String> expectedDataGroupNames =
			signalFieldAxes.keySet().stream().collect(Collectors.toMap(Function.identity(),
			x -> detectorName + (x.equals(NXdetector.NX_DATA) ? "" : "_" + x)));

	// validate the main NXdata generated by the NexusDataBuilder
	Map<String, NXdata> nxDataGroups = entry.getChildren(NXdata.class);
	assertEquals(signalFieldAxes.size(), nxDataGroups.size());
	assertTrue(nxDataGroups.keySet().containsAll(
			expectedDataGroupNames.values()));
	for (String nxDataGroupName : nxDataGroups.keySet()) {
		NXdata nxData = entry.getData(nxDataGroupName);

		String sourceFieldName = nxDataGroupName.equals(detectorName) ? NXdetector.NX_DATA :
			nxDataGroupName.substring(nxDataGroupName.indexOf('_') + 1);
		assertSignal(nxData, sourceFieldName);
		// check the nxData's signal field is a link to the appropriate source data node of the detector
		DataNode dataNode = detector.getDataNode(sourceFieldName);
		IDataset dataset = dataNode.getDataset().getSlice();
		assertSame(dataNode, nxData.getDataNode(sourceFieldName));
		assertTarget(nxData, sourceFieldName, rootNode, "/entry/instrument/" + detectorName
				+ "/" + sourceFieldName);

		// check that the other primary data fields of the detector haven't been added to this NXdata
		for (String primaryDataFieldName : signalFieldAxes.keySet()) {
			if (!primaryDataFieldName.equals(sourceFieldName)) {
				assertNull(nxData.getDataNode(primaryDataFieldName));
			}
		}

		int[] shape = dataset.getShape();

		// Make sure none of the numbers are NaNs. The detector
		// is expected to fill this scan with non-nulls.
		final PositionIterator it = new PositionIterator(shape);
		while (it.hasNext()) {
			int[] next = it.getPos();
			assertFalse(Double.isNaN(dataset.getDouble(next)));
		}

		// Check axes
		List<String> expectedAxesNames = signalFieldAxes.get(sourceFieldName);
		assertAxes(nxData, expectedAxesNames.toArray(new String[expectedAxesNames.size()]));
	}
}
 
開發者ID:eclipse,項目名稱:scanning,代碼行數:64,代碼來源:MandelbrotAcquireTest.java


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