当前位置: 首页>>代码示例>>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;未经允许,请勿转载。