Java List Join sortAndJoin(List list)

Here you can find the source of sortAndJoin(List list)

Description

sort And Join

License

Apache License

Declaration

static String sortAndJoin(List<String> list) 

Method Source Code


//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License");

import java.util.Collections;
import java.util.List;

public class Main {
    static String sortAndJoin(List<String> list) {
        Collections.sort(list);//from  ww  w.  ja va 2 s.  c  o  m

        StringBuilder builder = new StringBuilder(10 * list.size());

        String sep = "";

        for (String name : list) {
            builder.append(sep);
            builder.append(name);

            sep = " ";
        }

        return builder.toString();
    }
}

Related

  1. listToStr(List list, String joinChar)
  2. listToText(List list, String join)
  3. orderJoinType(List jList)
  4. reverseJoinType(List jList)
  5. sortAndJoin(List col, String sep)
  6. stringJoin(List list, String separator)
  7. stringJoin(List list, String sep)
  8. trimAndJoin(List values, String delimiter)

    HOME | Copyright © www.java2s.com 2016