Added List.joining(delim, prefix, suffix) convenience method
This commit is contained in:
parent
845dc26c83
commit
db85b77dad
|
@ -374,6 +374,14 @@ public class ExpressionFormatMethods {
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String joining(List<?> self, String delimiter, String prefix, String suffix) {
|
||||||
|
String[] list = self.stream().filter(Objects::nonNull).map(Objects::toString).filter(s -> !s.isEmpty()).toArray(String[]::new);
|
||||||
|
if (list.length == 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return prefix + String.join(delimiter, list) + suffix;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unwind if an object does not satisfy the given predicate
|
* Unwind if an object does not satisfy the given predicate
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue