本文整理汇总了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;
}
示例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;
}
}
示例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;
}
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例8: totalResults
import java.util.LinkedHashMap; //导入方法依赖的package包/类
private int totalResults() {
if (mTotalResults < 0) {
for (final LinkedHashMap<?, ?> map : mRecyclerViewAdapterRowIndices) {
mTotalResults += map.size();
}
}
return mTotalResults + 1;
}
示例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;
}
示例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));
}
}
示例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);
}
示例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();
}
示例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;
}
示例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");
// }
}
示例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");
// }
}