Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Won't Fix
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
I would like List.join method to not include null and empty elements. Similar to apache StringUtils.join. Perhaps a new join method that takes a boolean could be added?
Actually, I was wrong about apache StringUtils. It doesn't remove null/whitespace elements.
I guess what I'm asking for is something like this to be part of core groovy:
List.metaClass.nullSafeJoin = { separator ->
{ it && !it.isAllWhitespace() }delegate.findAll
.join(separator)
}