我有一個屬性變量,有時我需要添加其他屬性。如何在java中排序屬性?
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()
對它們進行排序,然後將它們全部放到一個新的對象中。有沒有更好的辦法?
http://www.rgagnon.com/javadetails/java-0614.html – nayakam 2012-04-23 06:46:36
@Thillakan我貼上相同的鏈接,但看完後刪除了「我不想獲取所有的鍵和值,用Collections.sort()對它們進行排序...「 – 2012-04-23 06:48:27