aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick/util/TagUtils.java
blob: fec59f2998d654df540cddb1c29c2bee0112deae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package com.juick.util;

import com.juick.Tag;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;

import java.util.List;
import java.util.stream.Collectors;

/**
 * Created by aalexeev on 11/13/16.
 */
public class TagUtils {
    private TagUtils() {
        throw new IllegalStateException();
    }

    public static String toString(final List<Tag> tags) {
        if (CollectionUtils.isEmpty(tags))
            return StringUtils.EMPTY;

        return tags.stream().map(t -> " *" + t.getName())
                .collect(Collectors.joining());
    }
}