On Fri, Feb 14, 2003 at 10:10:34AM +0100, Karin Lagesen wrote: > I have a Sequence which I have stuck several Features onto. I would > now like to iterate over these features, in the order that they appear > on the genome (i.e. a Feature from [7,10] comes before [8-20]). I see > that there is an inner class in Feature called > Feature.ByLocationComparator, I am just wondering how I am supposed to > use this (or if I indeed should use this).
FeatureHolders don't have any built-in support for sorting in arbitrary ways, but that comparator will do what you want: List fl = new ArrayList(); for (Iterator i = seq.features(); i.hasNext(); ) { fl.add(i.next()); } Collections.sort(fl, Feature.byLocationOrder); Thomas. _______________________________________________ Biojava-l mailing list - [EMAIL PROTECTED] http://biojava.org/mailman/listinfo/biojava-l