Replace FluentIterable with streams

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=180005797
This commit is contained in:
guyben 2017-12-23 07:08:35 -08:00 committed by Ben McIlwain
parent 552ab12314
commit 3f7cd00882
13 changed files with 121 additions and 104 deletions

View file

@ -15,6 +15,7 @@
package google.registry.model.common;
import static com.google.common.collect.DiscreteDomain.integers;
import static com.google.common.collect.ImmutableList.toImmutableList;
import static google.registry.util.DateTimeUtils.END_OF_TIME;
import static google.registry.util.DateTimeUtils.START_OF_TIME;
import static google.registry.util.DateTimeUtils.isAtOrAfter;
@ -23,7 +24,6 @@ import static org.joda.time.DateTimeZone.UTC;
import com.google.common.base.Splitter;
import com.google.common.collect.ContiguousSet;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.Range;
import com.googlecode.objectify.annotation.Embed;
import com.googlecode.objectify.annotation.Index;
@ -83,9 +83,11 @@ public class TimeOfYear extends ImmutableObject {
Range<Integer> yearRange = Range.closed(
normalizedRange.lowerEndpoint().getYear(),
normalizedRange.upperEndpoint().getYear());
return FluentIterable.from(ContiguousSet.create(yearRange, integers()))
.transform(this::getDateTimeWithYear)
.filter(normalizedRange);
return ContiguousSet.create(yearRange, integers())
.stream()
.map(this::getDateTimeWithYear)
.filter(normalizedRange)
.collect(toImmutableList());
}
/** Get the first {@link DateTime} with this month/day/millis that is at or after the start. */