Skip to content

Commit 23730ea

Browse files
committed
Ran scalafmt
1 parent 930039f commit 23730ea

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

scala-core-modules/scala-core-8/src/main/scala/com/baeldung/scala/dates/DateListGenerator.scala

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ import scala.annotation.tailrec
66

77
object DateListGenerator {
88

9-
def recursiveDateList(startDate: LocalDate, endDate: LocalDate): List[LocalDate] = {
9+
def recursiveDateList(
10+
startDate: LocalDate,
11+
endDate: LocalDate
12+
): List[LocalDate] = {
1013
@tailrec
1114
def findNextDate(
1215
currentDate: LocalDate,
@@ -21,30 +24,45 @@ object DateListGenerator {
2124
findNextDate(startDate, Nil)
2225
}
2326

24-
def foldLeftDateList(startDate: LocalDate, endDate: LocalDate): List[LocalDate] = {
27+
def foldLeftDateList(
28+
startDate: LocalDate,
29+
endDate: LocalDate
30+
): List[LocalDate] = {
2531
val noOfDays = ChronoUnit.DAYS.between(startDate, endDate) + 1
2632
(0 until noOfDays.toInt).foldLeft(List.empty[LocalDate]) { (acc, incr) =>
2733
acc :+ startDate.plusDays(incr)
2834
}
2935
}
3036

31-
def iteratorDateList(startDate: LocalDate, endDate: LocalDate): List[LocalDate] = {
37+
def iteratorDateList(
38+
startDate: LocalDate,
39+
endDate: LocalDate
40+
): List[LocalDate] = {
3241
Iterator
3342
.iterate(startDate)(_.plusDays(1))
3443
.takeWhile(!_.isAfter(endDate))
3544
.toList
3645
}
3746

38-
def tabulateDateList(startDate: LocalDate, endDate: LocalDate): List[LocalDate] = {
47+
def tabulateDateList(
48+
startDate: LocalDate,
49+
endDate: LocalDate
50+
): List[LocalDate] = {
3951
val noOfDays = ChronoUnit.DAYS.between(startDate, endDate) + 1
4052
List.tabulate(noOfDays.toInt)(startDate.plusDays(_))
4153
}
4254

43-
def dateListEpochDays(startDate: LocalDate, endDate: LocalDate): List[LocalDate] = {
55+
def dateListEpochDays(
56+
startDate: LocalDate,
57+
endDate: LocalDate
58+
): List[LocalDate] = {
4459
startDate.toEpochDay.to(endDate.toEpochDay).map(LocalDate.ofEpochDay).toList
4560
}
4661

47-
def dateListDaysBetween(startDate: LocalDate, endDate: LocalDate): List[LocalDate] = {
62+
def dateListDaysBetween(
63+
startDate: LocalDate,
64+
endDate: LocalDate
65+
): List[LocalDate] = {
4866
val noOfDays = ChronoUnit.DAYS.between(startDate, endDate) + 1
4967
(0 until noOfDays.toInt).map(startDate.plusDays(_)).toList
5068
}

0 commit comments

Comments
 (0)