I agree with Luke, it's better this way and reads fluently IMHO


On Wed, Oct 9, 2013 at 2:48 PM, tekul <notifications@github.com> wrote:

> In
> spring-xd-analytics/src/main/java/org/springframework/xd/analytics/metrics/memory/InMemoryAggregateCounter.java:
>
> > @@ -62,6 +63,12 @@ public InMemoryAggregateCounter(String name) {
> >  		super(name);
> >  	}
> >
> > +	public AggregateCount getCounts(int nCounts, Date endDate, AggregateCountResolution resolution) {
> > +		DateTime end = endDate == null ? new DateTime() : new DateTime(endDate.getTime());
>
> Java is verbose :). All it is doing is initializing a variable, which is
> obvious with this construct but not so much if you write
>
> DateTime end;
> if (endDate == null) {
> end = new DateTime();
> }
> else {
> end = new DateTime(endDate.getTime());
> }
>
> I could add a function called initializeToCurrentDateIfNull, but that
> seems like overkill. Alternatively we could add an additional method to the
> interface with signature
>
> public AggregateCount getCounts(int nCounts, AggregateCountResolution
> resolution)
>
> which would avoid having to use a null to represent an optional parameter
> (which I hate anyway) and remove the need to check for null, other than as
> an Assert.notNull(endDate);
>
> What do you think?
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/spring-projects/spring-xd/pull/342/files#r6854556>
> .
>