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


Java TreeMap.toString方法代码示例

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


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

示例1: testToString

import java.util.TreeMap; //导入方法依赖的package包/类
/**
 * toString contains toString of elements
 */
public void testToString() {
    TreeMap map = map5();
    String s = map.toString();
    for (int i = 1; i <= 5; ++i) {
        assertTrue(s.contains(String.valueOf(i)));
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:TreeMapTest.java

示例2: toString

import java.util.TreeMap; //导入方法依赖的package包/类
@Override
public String toString() {
	final Class<?> thisClass = getClass();
	final TreeMap<String,Object> values = new TreeMap<>();
	for (final Field f : thisClass.getDeclaredFields()) {
		if (ReadWriteLock.class.isAssignableFrom(f.getClass())) continue;
		if ((f.getModifiers() & Modifier.STATIC) != 0) continue;
		try {
			values.put(f.getName(), f.get(this));
		} catch (final IllegalAccessException e) {
			values.put(f.getName(), "<THIS SHOULD NOT HAPPEN>");
		}
	}
	return values.toString();
}
 
开发者ID:LAW-Unimi,项目名称:BUbiNG,代码行数:16,代码来源:RuntimeConfiguration.java

示例3: parseOneWordList

import java.util.TreeMap; //导入方法依赖的package包/类
/**
 * Parse one JSON-formatted word list metadata.
 * @param reader the reader containing the data.
 * @return a WordListMetadata object from the parsed data.
 * @throws IOException if the underlying reader throws IOException during reading.
 */
private static WordListMetadata parseOneWordList(final JsonReader reader)
        throws IOException, BadFormatException {
    final TreeMap<String, String> arguments = new TreeMap<>();
    reader.beginObject();
    while (reader.hasNext()) {
        final String name = reader.nextName();
        if (!TextUtils.isEmpty(name)) {
            arguments.put(name, reader.nextString());
        }
    }
    reader.endObject();
    if (TextUtils.isEmpty(arguments.get(ID_FIELD_NAME))
            || TextUtils.isEmpty(arguments.get(LOCALE_FIELD_NAME))
            || TextUtils.isEmpty(arguments.get(DESCRIPTION_FIELD_NAME))
            || TextUtils.isEmpty(arguments.get(UPDATE_FIELD_NAME))
            || TextUtils.isEmpty(arguments.get(FILESIZE_FIELD_NAME))
            || TextUtils.isEmpty(arguments.get(CHECKSUM_FIELD_NAME))
            || TextUtils.isEmpty(arguments.get(REMOTE_FILENAME_FIELD_NAME))
            || TextUtils.isEmpty(arguments.get(VERSION_FIELD_NAME))
            || TextUtils.isEmpty(arguments.get(FORMATVERSION_FIELD_NAME))) {
        throw new BadFormatException(arguments.toString());
    }
    // TODO: need to find out whether it's bulk or update
    // The null argument is the local file name, which is not known at this time and will
    // be decided later.
    return new WordListMetadata(
            arguments.get(ID_FIELD_NAME),
            MetadataDbHelper.TYPE_BULK,
            arguments.get(DESCRIPTION_FIELD_NAME),
            Long.parseLong(arguments.get(UPDATE_FIELD_NAME)),
            Long.parseLong(arguments.get(FILESIZE_FIELD_NAME)),
            arguments.get(RAW_CHECKSUM_FIELD_NAME),
            arguments.get(CHECKSUM_FIELD_NAME),
            MetadataDbHelper.DICTIONARY_RETRY_THRESHOLD /* retryCount */,
            null,
            arguments.get(REMOTE_FILENAME_FIELD_NAME),
            Integer.parseInt(arguments.get(VERSION_FIELD_NAME)),
            Integer.parseInt(arguments.get(FORMATVERSION_FIELD_NAME)),
            0, arguments.get(LOCALE_FIELD_NAME));
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:47,代码来源:MetadataParser.java


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