У меня есть переменная Properties, и иногда мне нужно добавить к ней другие свойства.
Properties myBasicProps = this.getClass.getResourceAsStream(MY_PROPS_PATH);
...
Properties otherProps = new Properties();
otherProps.load(new StringReader(tempPropsString)); //tempPropsString contains my temporary properties
myBasicProps.putAll(otherProps);
Я хочу отсортировать myBasicProps
после этого. Я не хочу получать все ключи и значения, сортировать их с помощью Collections.sort()
, а затем переносить все на новый объект. Есть ли лучший способ?