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


Java LinkedHashMap.size方法代碼示例

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


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

示例1: getAllExtraWordsNameList

import java.util.LinkedHashMap; //導入方法依賴的package包/類
public static String[] getAllExtraWordsNameList(LinkedHashMap<String, String> data, boolean defaultOpinion, String defaultString) {
    int length;
    if (defaultOpinion) {
        length = data.size() + 1;
    } else {
        length = data.size();
    }
    String[] result = new String[length];
    int start = 0;
    if (defaultOpinion && defaultString != null) {
        result[0] = defaultString;
        start++;
    }
    for (Object o : data.entrySet()) {
        LinkedHashMap.Entry entry = (LinkedHashMap.Entry) o;
        result[start] = entry.getKey().toString();
        start++;
    }
    return result;
}
 
開發者ID:XFY9326,項目名稱:CatchSpy,代碼行數:21,代碼來源:ExtraWordMethod.java

示例2: isSame

import java.util.LinkedHashMap; //導入方法依賴的package包/類
private static boolean isSame(LinkedHashMap<Attribute<Object>, Object> attrMap, Attribute<?>[] oldAttrs,
		Object[] oldValues) {
	if (oldAttrs.length != attrMap.size()) {
		return false;
	} else {
		int j = -1;
		for (Map.Entry<Attribute<Object>, Object> entry : attrMap.entrySet()) {
			j++;

			Attribute<Object> a = entry.getKey();
			if (!oldAttrs[j].equals(a) || j >= oldValues.length)
				return false;
			Object ov = oldValues[j];
			Object nv = entry.getValue();
			if (ov == null ? nv != null : !ov.equals(nv))
				return false;
		}
		return true;
	}
}
 
開發者ID:LogisimIt,項目名稱:Logisim,代碼行數:21,代碼來源:SelectionAttributes.java

示例3: identifyAggregateExpressions

import java.util.LinkedHashMap; //導入方法依賴的package包/類
private LinkedHashMap<Integer, CompiledAggregateFunction> identifyAggregateExpressions(
    List projAttribs) {
  if (projAttribs != null) {
    LinkedHashMap<Integer, CompiledAggregateFunction> mapping =
        new LinkedHashMap<Integer, CompiledAggregateFunction>();
    int index = 0;
    for (Object o : projAttribs) {
      CompiledValue proj = (CompiledValue) ((Object[]) o)[1];
      if (proj.getType() == OQLLexerTokenTypes.AGG_FUNC) {
        mapping.put(index, (CompiledAggregateFunction) proj);
      }
      ++index;
    }
    return mapping.size() == 0 ? null : mapping;
  } else {
    return null;
  }

}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:20,代碼來源:QCompiler.java

示例4: CompiledGroupBySelect

import java.util.LinkedHashMap; //導入方法依賴的package包/類
public CompiledGroupBySelect(boolean distinct, boolean count, CompiledValue whereClause,
    List iterators, List projAttrs, List<CompiledSortCriterion> orderByAttrs, CompiledValue limit,
    List<String> hints, List<CompiledValue> groupByClause,
    LinkedHashMap<Integer, CompiledAggregateFunction> aggMap) {
  super(false, false, whereClause, iterators, projAttrs, null, null, hints, groupByClause);
  this.aggregateFunctions = new CompiledAggregateFunction[aggMap != null ? aggMap.size() : 0];
  this.aggregateColsPos = new BitSet(this.projAttrs.size());
  if (aggMap != null) {
    int i = 0;
    for (Map.Entry<Integer, CompiledAggregateFunction> entry : aggMap.entrySet()) {
      this.aggregateColsPos.set(entry.getKey().intValue());
      this.aggregateFunctions[i++] = entry.getValue();
    }
  }
  this.originalOrderByClause = orderByAttrs;
  this.isDistinct = distinct;
  this.limit = limit;
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:19,代碼來源:CompiledGroupBySelect.java

示例5: CustomDictionaryEntry

import java.util.LinkedHashMap; //導入方法依賴的package包/類
public CustomDictionaryEntry(String hwd, LinkedHashMap<String, String> lhm){
    if(hwd == null || hwd.trim().isEmpty())
    {
        throw new IllegalArgumentException("headword can't be null or empty!");
    }
    if(lhm == null || lhm.size() < MIN_ELEMENT_NUMBER){
        throw new IllegalArgumentException("elements map can't be null or size less than " + MIN_ELEMENT_NUMBER);
    }

    headWord = hwd;
    extraHeadWordList = new ArrayList<>();
    elementsMap = lhm;
}
 
開發者ID:mmjang,項目名稱:quiz_helper,代碼行數:14,代碼來源:CustomDictionaryEntry.java

示例6: computeDiploidReadHaplotypeLikelihoods

import java.util.LinkedHashMap; //導入方法依賴的package包/類
public synchronized double[] computeDiploidReadHaplotypeLikelihoods(final ReadBackedPileup pileup,
                                                                    final LinkedHashMap<Allele, Haplotype> haplotypeMap,
                                                                    final ReferenceContext ref,
                                                                    final int eventLength,
                                                                    final PerReadAlleleLikelihoodMap perReadAlleleLikelihoodMap,
                                                                    final double downsamplingFraction) {
    final int numHaplotypes = haplotypeMap.size();

    final double[][] readLikelihoods = computeGeneralReadHaplotypeLikelihoods(pileup, haplotypeMap, ref, eventLength, perReadAlleleLikelihoodMap);
    perReadAlleleLikelihoodMap.performPerAlleleDownsampling(downsamplingFraction);
    return getDiploidHaplotypeLikelihoods(numHaplotypes, readLikelihoods);

}
 
開發者ID:PAA-NCIC,項目名稱:SparkSeq,代碼行數:14,代碼來源:PairHMMIndelErrorModel.java

示例7: ContentSizeBucketsDisplayHandler

import java.util.LinkedHashMap; //導入方法依賴的package包/類
public ContentSizeBucketsDisplayHandler(Set<String> facetQueryFields, LinkedHashMap<String, String> sizeBucketsMap)
{
    ParameterCheck.mandatory("facetQueryFields", facetQueryFields);
    ParameterCheck.mandatory("sizeBucketsMap", sizeBucketsMap);

    this.supportedFieldFacets = Collections.unmodifiableSet(facetQueryFields);

    facetLabelMap = new HashMap<>(sizeBucketsMap.size());
    Map<String, List<String>> facetQueries = new LinkedHashMap<>(facetQueryFields.size());

    for (String facetQueryField : facetQueryFields)
    {
        List<String> queries = new ArrayList<>();
        int index = 0;
        for (Entry<String, String> bucket : sizeBucketsMap.entrySet())
        {
            String sizeRange = bucket.getKey().trim();
            Matcher matcher = SIZE_RANGE_PATTERN.matcher(sizeRange);
            if (!matcher.find())
            {
                throw new SolrFacetConfigException(
                            "Invalid size range. Example of a valid size range is: [0 TO 1024]");
            }
            // build the facet query. e.g. {http://www.alfresco.org/model/content/1.0}content.size:[0 TO 1024]
            String facetQuery = facetQueryField + ':' + sizeRange;
            queries.add(facetQuery);

            // indexOf('[') => 1
            String sizeRangeQuery = sizeRange.substring(1, sizeRange.length() - 1);
            sizeRangeQuery = sizeRangeQuery.replaceFirst("\\sTO\\s", "\"..\"");
            facetLabelMap.put(facetQuery, new FacetLabel(sizeRangeQuery, bucket.getValue(), index++));
        }
        facetQueries.put(facetQueryField, queries);
    }
    this.facetQueriesMap = Collections.unmodifiableMap(facetQueries);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:37,代碼來源:ContentSizeBucketsDisplayHandler.java

示例8: totalResults

import java.util.LinkedHashMap; //導入方法依賴的package包/類
private int totalResults() {
    if (mTotalResults < 0) {
        for (final LinkedHashMap<?, ?> map : mRecyclerViewAdapterRowIndices) {
            mTotalResults += map.size();
        }
    }
    return mTotalResults + 1;
}
 
開發者ID:Applications-Development,項目名稱:SimpleRssReader,代碼行數:9,代碼來源:SearchResultsCursor.java

示例9: parseArray

import java.util.LinkedHashMap; //導入方法依賴的package包/類
public static LinkedHashMap<String,BundleListing.BundleInfo> parseArray(String listingStr,LinkedHashMap<String,BundleListing.BundleInfo>currentBundleInfo) throws Exception{
    LinkedHashMap<String,BundleListing.BundleInfo> infos= new LinkedHashMap<>();
    JSONArray array = JSON.parseArray(listingStr);
    for(int x=0; x<array.size(); x++){
        JSONObject object = array.getJSONObject(x);
        BundleListing.BundleInfo info = new BundleListing.BundleInfo();
        info.setName(object.getString("name"));
        info.setPkgName(object.getString("pkgName"));
        info.setApplicationName(object.getString("applicationName"));
        info.setVersion(object.getString("version"));
        info.setDesc(object.getString("desc"));
        info.setUrl(object.getString("url"));
        info.setMd5(object.getString("md5"));
        String uniqueTag = object.getString("unique_tag");
        if(StringUtils.isEmpty(uniqueTag)){
            throw new IOException("uniqueTag is empty");
        }
        info.setUnique_tag(object.getString("unique_tag"));
        if (currentBundleInfo==null) {
            info.setCurrent_unique_tag(info.getUnique_tag());
        }else {
            if (currentBundleInfo.get(info.getPkgName())!= null){
                info.setCurrent_unique_tag(currentBundleInfo.get(info.getPkgName()).getUnique_tag());
            }
        }

        infos.put(info.getPkgName(),info);

    }
    return infos.size()>0 ? infos : null;
}
 
開發者ID:alibaba,項目名稱:atlas,代碼行數:32,代碼來源:BundleListingUtil.java

示例10: setSchedules

import java.util.LinkedHashMap; //導入方法依賴的package包/類
/**
 * Set the schedules to be displayed in the reorder list.
 *
 * @param schedules SchedulesUtil
 */
public void setSchedules(LinkedHashMap<String, Schedule> schedules) {
    this.schedules = new ArrayList<>(schedules.size());
    this.schedulesDelete = new HashMap<>(schedules.size());

    long i = 0;

    for (Schedule schedule : schedules.values()) {
        this.schedules.add(new Pair<>(i++, schedule));
    }
}
 
開發者ID:linklux,項目名稱:android-schedules,代碼行數:16,代碼來源:ManageDialogFragment.java

示例11: call

import java.util.LinkedHashMap; //導入方法依賴的package包/類
public Node call(int location, LinkedHashMap<Symbol, Node> params, Address self) throws Exception {
    if (params == null) {
        if (numberOfArgs != 0) throw new Exception(location + ": 引數の個數が違います");
    } else {
        if (params.size() - 1 != numberOfArgs) throw new Exception(location + ": 引數の個數が違います");
    }
    return exec(params, self);
}
 
開發者ID:xemime-lang,項目名稱:xemime,代碼行數:9,代碼來源:Func.java

示例12: Function

import java.util.LinkedHashMap; //導入方法依賴的package包/類
public Function(int location, Type type, LinkedHashMap<Symbol, Type> params, ArrayList<Node> body) {
    super(location);
    this.type = type;
    this.params = params;
    this.body = body;
    this.numberOfArgs = params.size();
}
 
開發者ID:xemime-lang,項目名稱:xemime,代碼行數:8,代碼來源:Function.java

示例13: getMessages

import java.util.LinkedHashMap; //導入方法依賴的package包/類
protected MatrixCursor getMessages(String[] projection) throws InterruptedException {
    BlockingQueue<List<MessageInfoHolder>> queue = new SynchronousQueue<List<MessageInfoHolder>>();

    // new code for integrated inbox, only execute this once as it will be processed afterwards via the listener
    SearchAccount integratedInboxAccount = SearchAccount.createUnifiedInboxAccount(getContext());
    MessagingController msgController = MessagingController.getInstance(getContext());

    msgController.searchLocalMessages(integratedInboxAccount.getRelatedSearch(),
            new MessageInfoHolderRetrieverListener(queue));

    List<MessageInfoHolder> holders = queue.take();

    // TODO add sort order parameter
    Collections.sort(holders, new ReverseDateComparator());

    String[] projectionToUse;
    if (projection == null) {
        projectionToUse = DEFAULT_MESSAGE_PROJECTION;
    } else {
        projectionToUse = projection;
    }

    LinkedHashMap<String, FieldExtractor<MessageInfoHolder, ?>> extractors =
            resolveMessageExtractors(projectionToUse, holders.size());
    int fieldCount = extractors.size();

    String[] actualProjection = extractors.keySet().toArray(new String[fieldCount]);
    MatrixCursor cursor = new MatrixCursor(actualProjection);

    for (MessageInfoHolder holder : holders) {
        Object[] o = new Object[fieldCount];

        int i = 0;
        for (FieldExtractor<MessageInfoHolder, ?> extractor : extractors.values()) {
            o[i] = extractor.getField(holder);
            i += 1;
        }

        cursor.addRow(o);
    }

    return cursor;
}
 
開發者ID:philipwhiuk,項目名稱:q-mail,代碼行數:44,代碼來源:MessageProvider.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>(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

示例15: 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


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