1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-11-12 11:24:34 +00:00

Replace Collections methods with {List,Map,Set}.of

The two implementations aren't entirely compatible - the implementation
returned by .of will throw an NPE on .contains(null), whereas the
Collections implementations just return false. However, we try to avoid
passing null to collections methods, so this should be safe.

There's no strong reason to do this, but it helps make the code a little
more consistent
This commit is contained in:
Jonathan Coates
2023-10-21 10:37:43 +01:00
parent 8eabd4f303
commit cab66a2d6e
37 changed files with 79 additions and 95 deletions

View File

@@ -16,7 +16,6 @@ import org.hamcrest.Matcher;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@@ -110,7 +109,7 @@ public class UploadFileMessageTest {
@Provide
Arbitrary<FileUpload> fileUpload() {
return Combinators.combine(
Arbitraries.oneOf(Arrays.asList(
Arbitraries.oneOf(List.of(
// 1.16 doesn't correctly handle unicode file names. We'll be generous in our tests here.
Arbitraries.strings().ofMinLength(1).ascii().ofMaxLength(MAX_FILE_NAME),
Arbitraries.strings().ofMinLength(1).ofMaxLength(MAX_FILE_NAME / 4)