当前位置: 首页>>代码示例>>Java>>正文


Java LinkedHashMap.isEmpty方法代码示例

本文整理汇总了Java中java.util.LinkedHashMap.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java LinkedHashMap.isEmpty方法的具体用法?Java LinkedHashMap.isEmpty怎么用?Java LinkedHashMap.isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.LinkedHashMap的用法示例。


在下文中一共展示了LinkedHashMap.isEmpty方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initFirstTime

import java.util.LinkedHashMap; //导入方法依赖的package包/类
/** initialize with checking for repeats. Heavy work, but done only for the first candidate doc.<p>
 * If there are repetitions, check if multi-term postings (MTP) are involved.<p>
 * Without MTP, once PPs are placed in the first candidate doc, repeats (and groups) are visible.<br>
 * With MTP, a more complex check is needed, up-front, as there may be "hidden collisions".<br>
 * For example P1 has {A,B}, P1 has {B,C}, and the first doc is: "A C B". At start, P1 would point
 * to "A", p2 to "C", and it will not be identified that P1 and P2 are repetitions of each other.<p>
 * The more complex initialization has two parts:<br>
 * (1) identification of repetition groups.<br>
 * (2) advancing repeat groups at the start of the doc.<br>
 * For (1), a possible solution is to just create a single repetition group, 
 * made of all repeating pps. But this would slow down the check for collisions, 
 * as all pps would need to be checked. Instead, we compute "connected regions" 
 * on the bipartite graph of postings and terms.  
 */
private boolean initFirstTime() throws IOException {
  //System.err.println("initFirstTime: doc: "+min.doc);
  checkedRpts = true;
  placeFirstPositions();

  LinkedHashMap<Term,Integer> rptTerms = repeatingTerms(); 
  hasRpts = !rptTerms.isEmpty();

  if (hasRpts) {
    rptStack = new PhrasePositions[numPostings]; // needed with repetitions
    ArrayList<ArrayList<PhrasePositions>> rgs = gatherRptGroups(rptTerms);
    sortRptGroups(rgs);
    if (!advanceRepeatGroups()) {
      return false; // PPs exhausted
    }
  }
  
  fillQueue();
  return true; // PPs available
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:35,代码来源:SloppyPhraseScorer.java

示例2: getCrftsCount

import java.util.LinkedHashMap; //导入方法依赖的package包/类
/**
 * crftの個数を返します
 * @return int
 */
public int getCrftsCount() {
  final int[] cc = {0};
  LinkedHashMap<String, LinkedHashMap<Long, CantRemoveFloatingText>> crfts = getCrfts();
  if (!crfts.isEmpty()) {
    crfts.forEach((levelName, lhm) -> lhm.forEach((eid, crft) -> cc[0]++));
  }
  System.out.println(cc[0]);// TODO: 2017/09/12 final int は謎構文 
  return cc[0];
}
 
开发者ID:fuyutsuki,项目名称:Texter_nukkit,代码行数:14,代码来源:TexterApi.java

示例3: getFtsCount

import java.util.LinkedHashMap; //导入方法依赖的package包/类
/**
 * crftの個数を返します
 * @return int
 */
public int getFtsCount() {
  final int[] cc = {0};
  LinkedHashMap<String, LinkedHashMap<Long, FloatingText>> fts = getFts();
  if (!fts.isEmpty()) {
    fts.forEach((levelName, lhm) -> lhm.forEach((eid, ft) -> cc[0]++));
  }
  System.out.println(cc[0]);// TODO: 2017/09/12 final int は謎構文
  return cc[0];
}
 
开发者ID:fuyutsuki,项目名称:Texter_nukkit,代码行数:14,代码来源:TexterApi.java

示例4: ConfigSection

import java.util.LinkedHashMap; //导入方法依赖的package包/类
/**
 * Constructor of ConfigSection, based on values stored in map.
 *
 * @param map
 */
public ConfigSection(LinkedHashMap<String, Object> map) {
    this();
    if (map == null || map.isEmpty()) return;
    for (Map.Entry<String, Object> entry : map.entrySet()) {
        if (entry.getValue() instanceof LinkedHashMap) {
            super.put(entry.getKey(), new ConfigSection((LinkedHashMap) entry.getValue()));
        } else {
            super.put(entry.getKey(), entry.getValue());
        }
    }
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:17,代码来源:ConfigSection.java

示例5: writeGroupedEntryMap

import java.util.LinkedHashMap; //导入方法依赖的package包/类
protected static <T extends GroupedBiomeEntry> void writeGroupedEntryMap(JsonObject writeTo, LinkedHashMap<String, T> list, String tagname) {
    if (!list.isEmpty()) {
        JsonObject categories = new JsonObject();
        writeGroupedEntryMap(categories, list);
        writeTo.add(tagname, categories);
    }
}
 
开发者ID:stuebz88,项目名称:modName,代码行数:8,代码来源:BiomeSettings.java

示例6: writeJsonableMap

import java.util.LinkedHashMap; //导入方法依赖的package包/类
static <T extends IJsonMappable> void writeJsonableMap(JsonObject o, LinkedHashMap<String, T> list, String tagname) {
    if (!list.isEmpty()) {
        JsonArray g = new JsonArray();
        for (T def : list.values()) {
            g.add(def.toJson());
        }
        o.add(tagname, g);
    }
}
 
开发者ID:stuebz88,项目名称:modName,代码行数:10,代码来源:Settings.java

示例7: getCtor

import java.util.LinkedHashMap; //导入方法依赖的package包/类
private static StringBuilder getCtor(FullyQualifiedName fqn , LinkedHashMap<String, String> parameters) {
    StringBuilder stringBuilder = new StringBuilder();
    stringBuilder.append("public ").append(fqn.getTypeName()).append("(");
    // parameters
    stringBuilder.append(Joiner.on(", ").withKeyValueSeparator(" ").join(parameters));
    stringBuilder.append(") {\n");
    if (!parameters.isEmpty()) {
        stringBuilder.append("super(");
        stringBuilder.append(Joiner.on(", ").join(parameters.values()));
        stringBuilder.append(");\n");
    }
    stringBuilder.append("}");
    return stringBuilder;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:15,代码来源:ConcreteModuleGeneratedObjectFactory.java

示例8: objectPropToNode

import java.util.LinkedHashMap; //导入方法依赖的package包/类
/**
 * 对象属性转换为xml标签
 * 
 * @param pd
 * @param xml
 * @throws NoSuchMethodException
 * @throws InvocationTargetException
 * @throws IllegalAccessException
 * @throws XMLStreamException
 */
private static void objectPropToNode(Object bean, XMLStreamWriter xml)
		throws IllegalAccessException, InvocationTargetException, NoSuchMethodException, XMLStreamException {
	if (bean == null) {
		return;
	}

	LinkedHashMap<String, Field> fields = new LinkedHashMap<String, Field>();
	getFields(bean.getClass(), fields);
	if (fields == null || fields.isEmpty()) {
		return;
	}
	for (Entry<String, Field> fieldEntry : fields.entrySet()) {
		String name = fieldEntry.getKey();
		Object value = null;
		try {
			value = PropertyUtils.getProperty(bean, name);
		} catch (Exception ex) {
		}
		if (value == null) {// 忽略空值
			continue;
		}

		String tag = fieldEntry.getValue().isAnnotationPresent(SerializedName.class) ? name
				: StringUtils.capitalize(name);// 首字母大写做为XML标签名,注解为SerializedName的不做处理

		Class<?> type = value.getClass();
		boolean isPrimitive = type.isPrimitive() || type.isEnum() || value instanceof String
				|| value instanceof Number;// 是否基本类型boolean、byte、char、short、int、long、float
		// 和 double 或 Enum
		boolean isArray = type.isArray();// 是否数组

		if (!isArray) {// 非数组型属性
			xml.writeStartElement(tag);// 写开始标签
			if (isPrimitive) {// 基本类型直接写内容
				xml.writeCData(String.valueOf(value));
			} else {
				objectPropToNode(value, xml);// 复合类型,递归解析
			}
			xml.writeEndElement();// 写结束标签
		} else {// 数组型属性
			int length = Array.getLength(value);
			for (int i = 0; i < length; i++) {
				Object val = Array.get(value, i);
				if (val == null) {
					continue;
				}
				xml.writeStartElement(tag);// 写开始标签
				if (isPrimitive) {// 基本类型
					xml.writeCData(String.valueOf(val));
				} else {// 复合类型
					objectPropToNode(val, xml);
				}
				xml.writeEndElement();// 写结束标签
			}
		}

	}
}
 
开发者ID:AlexLee-CN,项目名称:weixin_api,代码行数:69,代码来源:XmlUtil.java

示例9: setOrderByCols

import java.util.LinkedHashMap; //导入方法依赖的package包/类
public void setOrderByCols(LinkedHashMap<String, Integer> orderByCols) {
    if (orderByCols != null && !orderByCols.isEmpty()) {
        createSQLMergeIfNull().setOrderByCols(orderByCols);
    }
}
 
开发者ID:huang-up,项目名称:mycat-src-1.6.1-RELEASE,代码行数:6,代码来源:RouteResultset.java


注:本文中的java.util.LinkedHashMap.isEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。