Move probablyParallelStream to ext
This commit is contained in:
parent
026a670dec
commit
bdb2e85bcd
@ -409,3 +409,11 @@ fun ResourceLocation.toUUID(): UUID {
|
||||
fun String.toUUID(): UUID {
|
||||
return UUID.nameUUIDFromBytes(toByteArray(Charsets.UTF_8))
|
||||
}
|
||||
|
||||
fun <T> Collection<T>.probablyParallelStream(): Stream<out T> {
|
||||
if (size >= 400) {
|
||||
return parallelStream()
|
||||
}
|
||||
|
||||
return stream()
|
||||
}
|
||||
|
@ -23,18 +23,10 @@ import org.apache.logging.log4j.LogManager
|
||||
import ru.dbotthepony.mc.otm.core.ImpreciseFraction
|
||||
import ru.dbotthepony.mc.otm.core.integerDivisionDown
|
||||
import ru.dbotthepony.mc.otm.core.integerDivisionUp
|
||||
import ru.dbotthepony.mc.otm.core.probablyParallelStream
|
||||
import ru.dbotthepony.mc.otm.core.registryName
|
||||
import ru.dbotthepony.mc.otm.core.set
|
||||
import ru.dbotthepony.mc.otm.data.stream
|
||||
import java.util.stream.Stream
|
||||
|
||||
private fun <T> Collection<T>.probablyParallelStream(): Stream<out T> {
|
||||
if (size >= 400) {
|
||||
return parallelStream()
|
||||
}
|
||||
|
||||
return stream()
|
||||
}
|
||||
|
||||
object MatterManager : SimpleJsonResourceReloadListener(GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create(), "otm_matter") {
|
||||
const val DIRECTORY = "otm_matter"
|
||||
|
Loading…
Reference in New Issue
Block a user