Browse Source

removed Java legacy code

the minimum is now Java 11
pull/18/head
Jannik 2 years ago
parent
commit
d0d5e4b6d1
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
  1. 5
      .drone.yml
  2. 4
      build.gradle
  3. 9
      src/main/kotlin/org/mosad/thecitadelofricks/controller/CacheController.kt
  4. 17
      src/main/kotlin/org/mosad/thecitadelofricks/controller/StatusController.kt

5
.drone.yml

@ -7,8 +7,3 @@ steps:
commands:
- gradle test
- name: test-jdk8
image: gradle:jdk8
commands:
- gradle test

4
build.gradle

@ -42,10 +42,10 @@ dependencies {
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.jvmTarget = "11"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.jvmTarget = "11"
}
group 'org.mosad'

9
src/main/kotlin/org/mosad/thecitadelofricks/controller/CacheController.kt

@ -128,14 +128,7 @@ class CacheController {
// get all lessons from the weeks timetable
val flatMap = getTimetable(courseName, weekIndex).timetable.days.flatMap { it.timeslots.asIterable() }
flatMap.forEach {
// TODO Java 11
//it.stream().filter { x -> x.lessonSubject.contains(lessonSubject) }.findAny().ifPresent { x -> println("${x.lessonSubject}, ${x.lessonTeacher}") }
it.forEach { lesson ->
if(lesson.lessonSubject.contains(lessonSubject)) {
lessonList.add(lesson)
}
}
it.stream().filter { x -> x.lessonSubject.contains(lessonSubject) }.findAny().ifPresent { x -> lessonList.add(x) }
}
return lessonList

17
src/main/kotlin/org/mosad/thecitadelofricks/controller/StatusController.kt

@ -56,18 +56,11 @@ class StatusController {
* if a timetable is requested update the request counter
*/
fun updateTimetableRequests(courseName: String) {
when (timetableRequests.stream().filter { x -> x.courseName == courseName }.findAny().orElse(null)) {
null -> timetableRequests.add(TimetableCounter(courseName, 0))
}
timetableRequests.stream().filter { x -> x.courseName == courseName }.findFirst()
.ifPresent { x -> x.requests++ }
// TODO Java 11
// timetableRequests.stream().filter { it.courseName == courseName }.findFirst().ifPresentOrElse({
// it.requests++
// }, {
//
// })
timetableRequests.stream().filter { it.courseName == courseName }.findFirst().ifPresentOrElse({
it.requests++
}, {
timetableRequests.add(TimetableCounter(courseName, 1))
})
}
fun getTotalRequests(): Int {

Loading…
Cancel
Save

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close