Sometimes you’ve got to sort a list. Instead of doing our own sort method, you can use the Collections.sort(List list) method. To be sorted, your list elements must be “Comparable” (Like int, String, Date etc…). To do this, the only things to do are to implements the Comparable interface and define the public int compareTo(Object object) method in your element class.
Archive for the ‘Java’ Category
XML with Java and JDOM
Posted by ObLiB on August 29, 2008
A few months ago, I worked on a java project which had to manage XML data. The XML data that I had to deal with weren’t very complex so I try to find the easiest way to manage XML data with Java and I found JDOM.
We want to provide a solution for using XML from Java that is as simple as Java itself.
There is no compelling reason for a Java API to manipulate XML to be complex, tricky, unintuitive, or a pain in the neck. JDOMTM is both Java-centric and Java-optimized. It behaves like Java, it uses Java collections, it is completely natural API for current Java developers, and it provides a low-cost entry point for using XML.
While JDOM interoperates well with existing standards such as the Simple API for XML (SAX) and the Document Object Model (DOM), it is not an abstraction layer or enhancement to those APIs. Rather, it provides a robust, light-weight means of reading and writing XML data without the complex and memory-consumptive options that current API offerings provide.
Posted in API, Java | Tagged: jdom, xml | 1 Comment »


