Java List Sort sortInputQueryKeys(List l)

Here you can find the source of sortInputQueryKeys(List l)

Description

Sort the input query list

License

BSD License

Parameter

Parameter Description
l a parameter

Declaration

public static void sortInputQueryKeys(List l) 

Method Source Code

//package com.java2s;
/*L/*www .  j  a v a 2 s . c  om*/
 * Copyright Washington University at St. Louis
 *
 * Distributed under the OSI-approved BSD 3-Clause License.
 * See http://ncip.github.com/geneconnect/LICENSE.txt for details.
 */

import java.util.List;

public class Main {
    /**
     * Sort the input query list
     * @param l
     */
    public static void sortInputQueryKeys(List l) {
        for (int i = 0; i < l.size(); i++) {
            for (int j = 0; j < l.size() - 1; j++) {
                String k1 = (String) l.get(j);
                int k = j + 1;
                String k2 = (String) l.get(k);
                String i1 = k1.substring(k1.indexOf(":") + 1, k1.indexOf("_"));
                String i2 = k2.substring(k2.indexOf(":") + 1, k2.indexOf("_"));
                if (Integer.decode(i1).intValue() > Integer.decode(i2).intValue()) {
                    l.remove(j);
                    l.add(j, k2);
                    l.remove(k);
                    l.add(k, k1);

                }
            }
        }
    }
}

Related

  1. sortedList(List list)
  2. sortedUnion(List args1, List args2)
  3. sortEntrySetToList(Set> set)
  4. sortIds(List ids)
  5. sortIfUnsorted(List genomes)
  6. sortItems(List items, String putOnTop)
  7. sortList(ArrayList list)
  8. sortList(Collection list)
  9. sortList(java.util.List types)