diff --git a/common/src/main/java/net/infumia/pack/ArbitraryCharacterFactoryReserved.java b/common/src/main/java/net/infumia/pack/ArbitraryCharacterFactoryReserved.java index 5798b11..a0625a2 100644 --- a/common/src/main/java/net/infumia/pack/ArbitraryCharacterFactoryReserved.java +++ b/common/src/main/java/net/infumia/pack/ArbitraryCharacterFactoryReserved.java @@ -1,8 +1,8 @@ package net.infumia.pack; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.HashSet; /** * A factory for creating arbitrary characters, ensuring that reserved characters are not produced. @@ -59,7 +59,7 @@ public char create() throws IllegalStateException { private static final class Internal { private static final Lazy> RESERVED = Lazy.of(() -> { - final Collection reserved = new HashSet<>(); + final Collection reserved = new ArrayList<>(); for (char c = 'a'; c <= 'z'; c++) { reserved.add(c); } diff --git a/common/src/main/java/net/infumia/pack/FileResourceMergerDefault.java b/common/src/main/java/net/infumia/pack/FileResourceMergerDefault.java index f4a0bd1..1a56f79 100644 --- a/common/src/main/java/net/infumia/pack/FileResourceMergerDefault.java +++ b/common/src/main/java/net/infumia/pack/FileResourceMergerDefault.java @@ -1,9 +1,9 @@ package net.infumia.pack; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Comparator; -import java.util.HashSet; import java.util.Optional; import java.util.stream.Collectors; import net.kyori.adventure.key.Key; @@ -31,14 +31,14 @@ private FileResourceMergerDefault() {} @Override public Collection merge(final Collection resources) { - final Collection simplified = new HashSet<>(resources.size()); + final Collection simplified = new ArrayList<>(resources.size()); for (final FileResource resource : resources) { simplified.addAll(this.simplify(resource)); } final MultiMap atlases = new MultiMap<>(); final MultiMap models = new MultiMap<>(); - final HashSet remaining = new HashSet<>(); + final Collection remaining = new ArrayList<>(); for (final FileResource resource : simplified) { if (resource instanceof FileResourceAtlas) { final Atlas atlas = ((FileResourceAtlas) resource).atlas; @@ -53,7 +53,7 @@ public Collection merge(final Collection resources) } } - final Collection mergedAtlases = new HashSet<>(atlases.keys().size()); + final Collection mergedAtlases = new ArrayList<>(atlases.keys().size()); for (final Key key : atlases.keys()) { final Collection duplicates = atlases.get(key); final Atlas merged = Atlas.atlas() @@ -69,7 +69,7 @@ public Collection merge(final Collection resources) mergedAtlases.add(merged); } - final Collection mergedModels = new HashSet<>(models.keys().size()); + final Collection mergedModels = new ArrayList<>(models.keys().size()); for (final Key key : models.keys()) { final Collection duplicates = models.get(key); final Model.Builder builder = Model.model().key(key); @@ -97,9 +97,9 @@ public Collection merge(final Collection resources) final Collection mergedResources = mergedAtlases .stream() .map(FileResources::atlas) - .collect(Collectors.toSet()); + .collect(Collectors.toList()); mergedResources.addAll( - mergedModels.stream().map(FileResources::model).collect(Collectors.toSet()) + mergedModels.stream().map(FileResources::model).collect(Collectors.toList()) ); mergedResources.addAll(remaining); return mergedResources; @@ -110,7 +110,7 @@ private Collection simplify(final FileResource resource) { return ((FileResourceAll) resource).resources.stream() .map(this::simplify) .flatMap(Collection::stream) - .collect(Collectors.toSet()); + .collect(Collectors.toList()); } else { return Collections.singletonList(resource); } diff --git a/common/src/main/java/net/infumia/pack/MultiMap.java b/common/src/main/java/net/infumia/pack/MultiMap.java index 5c9841f..0cfec3f 100644 --- a/common/src/main/java/net/infumia/pack/MultiMap.java +++ b/common/src/main/java/net/infumia/pack/MultiMap.java @@ -1,8 +1,8 @@ package net.infumia.pack; +import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; -import java.util.HashSet; import java.util.Map; final class MultiMap { @@ -12,7 +12,7 @@ final class MultiMap { MultiMap() {} void put(final K key, final V value) { - this.map.computeIfAbsent(key, __ -> new HashSet<>()).add(value); + this.map.computeIfAbsent(key, __ -> new ArrayList<>()).add(value); } Collection get(final K key) { diff --git a/generator/src/main/java/net/infumia/pack/PackReader.java b/generator/src/main/java/net/infumia/pack/PackReader.java index c59ab6a..a8da00e 100644 --- a/generator/src/main/java/net/infumia/pack/PackReader.java +++ b/generator/src/main/java/net/infumia/pack/PackReader.java @@ -61,14 +61,14 @@ private PackGeneratorContext read0(@NotNull final Stream walking) throws I .readAll() .stream() .map(part -> part.directory(path)) - .collect(Collectors.toSet()); + .collect(Collectors.toList()); } } catch (final IOException e) { throw new RuntimeException(e); } }) .flatMap(Collection::stream) - .collect(Collectors.toSet()); + .collect(Collectors.toList()); return new PackGeneratorContext( ResourcePack.resourcePack(), this.base,