Надо сохранять порядок файлов

This commit is contained in:
DBotThePony 2023-03-29 19:17:23 +07:00
parent 31c539948e
commit c04c89de0d
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -686,40 +686,25 @@ class Starbound : ISBFileLocator {
.flatMap { it.explore() }
.filter { it.isFile }
.collect(object :
Collector<IStarboundFile, Object2ObjectOpenHashMap<String, ArrayList<IStarboundFile>>,
Map<String, List<IStarboundFile>>>,
Supplier<Object2ObjectOpenHashMap<String, ArrayList<IStarboundFile>>>,
BiConsumer<Object2ObjectOpenHashMap<String, ArrayList<IStarboundFile>>, IStarboundFile>,
BinaryOperator<Object2ObjectOpenHashMap<String, ArrayList<IStarboundFile>>>
Collector<IStarboundFile, Object2ObjectOpenHashMap<String, ArrayList<IStarboundFile>>, Map<String, List<IStarboundFile>>>
{
override fun accept(t: Object2ObjectOpenHashMap<String, ArrayList<IStarboundFile>>, u: IStarboundFile) {
t.computeIfAbsent(u.name.substringAfterLast('.'), Object2ObjectFunction { ArrayList() }).add(u)
}
override fun get(): Object2ObjectOpenHashMap<String, ArrayList<IStarboundFile>> {
return Object2ObjectOpenHashMap()
}
override fun supplier(): Supplier<Object2ObjectOpenHashMap<String, ArrayList<IStarboundFile>>> {
return this
return Supplier { Object2ObjectOpenHashMap() }
}
override fun accumulator(): BiConsumer<Object2ObjectOpenHashMap<String, ArrayList<IStarboundFile>>, IStarboundFile> {
return this
}
override fun apply(
t: Object2ObjectOpenHashMap<String, ArrayList<IStarboundFile>>,
u: Object2ObjectOpenHashMap<String, ArrayList<IStarboundFile>>
): Object2ObjectOpenHashMap<String, ArrayList<IStarboundFile>> {
for ((k, v) in u)
t.computeIfAbsent(k, Object2ObjectFunction { ArrayList() }).addAll(v)
return t
return BiConsumer { t, u ->
t.computeIfAbsent(u.name.substringAfterLast('.'), Object2ObjectFunction { ArrayList() }).add(u)
}
}
override fun combiner(): BinaryOperator<Object2ObjectOpenHashMap<String, ArrayList<IStarboundFile>>> {
return this
return BinaryOperator { t, u ->
for ((k, v) in u)
t.computeIfAbsent(k, Object2ObjectFunction { ArrayList() }).addAll(v)
t
}
}
override fun finisher(): Function<Object2ObjectOpenHashMap<String, ArrayList<IStarboundFile>>, Map<String, List<IStarboundFile>>> {
@ -727,7 +712,7 @@ class Starbound : ISBFileLocator {
}
override fun characteristics(): Set<Collector.Characteristics> {
return setOf(Collector.Characteristics.IDENTITY_FINISH, Collector.Characteristics.UNORDERED)
return setOf(Collector.Characteristics.IDENTITY_FINISH)
}
})