Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ltd.genuine.util;
- import java.util.Collections;
- import java.util.Enumeration;
- import java.util.LinkedHashSet;
- import java.util.Properties;
- /**
- * LinkedProperties retains the put order (field order) of the Properties input,
- * the output of the properties file is the exact same as in the source fields order.
- * <p>
- * Also has the added benefit of keeping the order the same as the files order after
- * the config is written and then edited. Players can now keep track of modifications,
- * and make changes that are much more permanent.
- */
- public class LinkedProperties extends Properties {
- private final LinkedHashSet<Object> keys = new LinkedHashSet<Object>();
- public Enumeration<Object> keys() {
- return Collections.<Object> enumeration(keys);
- }
- public Object put(Object key, Object value) {
- keys.add(key);
- return super.put(key, value);
- }
- }
Advertisement