import com.google.common.base.Optional
import net.pterodactylus.rhynodge.filters.ComicSiteFilter
+import net.pterodactylus.rhynodge.utils.asOptional
import org.jsoup.nodes.Document
class SoggyCardboardComicFilter : ComicSiteFilter() {
listOf(document.select("#comic img").attr("alt"))
}
-
-fun <T> T?.asOptional(): Optional<T> = Optional.fromNullable(this)
--- /dev/null
+package net.pterodactylus.rhynodge.utils
+
+import com.google.common.base.Optional
+
+fun <T> T?.asOptional(): Optional<T> = Optional.fromNullable(this)
+fun String?.asOptional(): Optional<String> = if ((this == null) || (this.isEmpty())) Optional.absent() else Optional.of(this)