Java List Sort sortUniqueTags(List unsortedTags)

Here you can find the source of sortUniqueTags(List unsortedTags)

Description

sort Unique Tags

License

Mozilla Public License

Declaration

public static List<String> sortUniqueTags(List<String> unsortedTags) 

Method Source Code


//package com.java2s;
/*/*from   w  ww .  j  a va 2s.  com*/
 * gnizr is a trademark of Image Matters LLC in the United States.
 * 
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 * 
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License
 * for the specific language governing rights and limitations under the License.
 * 
 * The Initial Contributor of the Original Code is Image Matters LLC.
 * Portions created by the Initial Contributor are Copyright (C) 2007
 * Image Matters LLC. All Rights Reserved.
 */

import java.util.ArrayList;

import java.util.List;

public class Main {
    public static List<String> sortUniqueTags(List<String> unsortedTags) {
        List<String> sorted = new ArrayList<String>();
        for (String t : unsortedTags) {
            t = t.trim();
            if (sorted.contains(t) == false) {
                sorted.add(t);
            }
        }
        return sorted;
    }
}

Related

  1. sortStringEnumeration(Enumeration list)
  2. sortStringList(List l, boolean ascending)
  3. sortStringList(List stringList)
  4. sortStringList(String[] listToSort, String[] priorityList)
  5. sortUniq(List list)
  6. sortVersions(List versions)
  7. stringListSort(List list)
  8. subtractSortedLists(List a, List b, Comparator comparator)
  9. toSortedList(Collection in)