Java List Sort sortNames(List nameLs, String splitStr)

Here you can find the source of sortNames(List nameLs, String splitStr)

Description

Sort the List Strings from back to front and split them with split.

License

Open Source License

Parameter

Parameter Description
nameLs a parameter
splitStr a parameter

Declaration

private static String sortNames(List<String> nameLs, String splitStr) 

Method Source Code

//package com.java2s;
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt

import java.util.List;

public class Main {
    /**//from  www. j  a  v  a2s .co m
     * 
     * Sort the List Strings from back to front and split them with split.
     * 
     * @param nameLs
     * @param splitStr
     * @return
     */
    private static String sortNames(List<String> nameLs, String splitStr) {
        StringBuffer strs = new StringBuffer();
        if (!nameLs.isEmpty()) {
            for (int i = nameLs.size() - 1; i >= 0; i--) {
                strs.append(nameLs.get(i));
                if (i != 0) {
                    strs.append(splitStr);
                }
            }
        }
        return strs.toString();

    }
}

Related

  1. sortLongSeqList(List firstList, List secondList)
  2. sortLoops(ArrayList list)
  3. sortMap(Map targetMap, List sortedList)
  4. sortMapEntryListByValue(List> entries, boolean descending)
  5. sortMessages(List ms)
  6. sortRepositorynames(List list)
  7. sortSimpleName(List list)
  8. sortSimpleName(List list)
  9. sortString(Set lists)