⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sortedproperties.java

📁 A static analysis tool to find bugs in Java programs
💻 JAVA
字号:
package edu.umd.cs.findbugs.config;import java.util.ArrayList;import java.util.Collections;import java.util.Enumeration;import java.util.List;import java.util.Properties;import java.util.Set;/** * @author pugh */public final class SortedProperties extends Properties {	/**	 * Overriden to be able to write properties sorted by keys to the disk	 * @see java.util.Hashtable#keys()	 */	@SuppressWarnings("unchecked")	@Override	public synchronized Enumeration<Object> keys() {		// sort elements based on detector (prop key) names		Set set = keySet();		return sortKeys(set);	}	/**	 * To be compatible with version control systems, we need to sort properties before	 * storing them to disk. Otherwise each change may lead to problems by diff against	 * previous version - because Property entries are randomly distributed (it's a map).	 *	 * @param keySet non null set instance to sort	 * @return non null list wich contains all given keys, sorted lexicographically.	 * The list may be empty if given set was empty	 */	static public Enumeration sortKeys(Set<String> keySet) {		List<String> sortedList = new ArrayList<String>();		sortedList.addAll(keySet);		Collections.sort(sortedList);		return Collections.enumeration(sortedList);	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -