From 36cefa32e6f39cc536217c01d1b9d7c1f6a7861e Mon Sep 17 00:00:00 2001 From: Seth Ladygo Date: Wed, 14 Nov 2018 18:29:25 -0800 Subject: [PATCH] EPLHelpers.str() now takes varargs --- src/main/java/EPLHelpers.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/java/EPLHelpers.java b/src/main/java/EPLHelpers.java index f40af94..628879d 100644 --- a/src/main/java/EPLHelpers.java +++ b/src/main/java/EPLHelpers.java @@ -1,3 +1,5 @@ +import java.util.StringJoiner; + import org.joda.time.DateTime; import org.joda.time.DateTimeComparator; import org.joda.time.format.DateTimeFormat; @@ -14,6 +16,17 @@ public class EPLHelpers { private static DateTimeComparator timeComparator = DateTimeComparator.getTimeOnlyInstance(); + /** + * A simple toString() wrapper. + */ + public static String str(Object... objects) { + StringJoiner sj = new StringJoiner(", "); + for (Object o : objects) { + sj.add(o != null ? o.toString() : "null"); + } + return sj.toString(); + } + /** * Return a DateTime object for the time. Should be specified in * 24-hour "hh:mm" format. @@ -22,8 +35,6 @@ public class EPLHelpers { return timeFormatter.parseDateTime(time); } - /** A simple toString() wrapper for use in epl. */ - public static String str(Object o) { return o.toString(); } /** * Return true if the time portion of 'now' is between the time * portion of 'start' and 'end'.