本文整理匯總了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
}
示例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];
}
示例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];
}
示例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());
}
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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();// 寫結束標簽
}
}
}
}
示例9: setOrderByCols
import java.util.LinkedHashMap; //導入方法依賴的package包/類
public void setOrderByCols(LinkedHashMap<String, Integer> orderByCols) {
if (orderByCols != null && !orderByCols.isEmpty()) {
createSQLMergeIfNull().setOrderByCols(orderByCols);
}
}