kafka/connect
Jhen-Yung Hsu 2e968560e0
MINOR: Cleanup simplify set initialization with Set.of (#19925)
Simplify Set initialization and reduce the overhead of creating extra
collections.

The changes mostly include:
- new HashSet<>(List.of(...))
- new HashSet<>(Arrays.asList(...)) / new HashSet<>(asList(...))
- new HashSet<>(Collections.singletonList()) / new
HashSet<>(singletonList())
- new HashSet<>(Collections.emptyList())
- new HashSet<>(Set.of())

This change takes the following into account, and we will not change to
Set.of in these scenarios:
- Require `mutability` (UnsupportedOperationException).
- Allow `duplicate` elements (IllegalArgumentException).
- Allow `null` elements (NullPointerException).
- Depend on `Ordering`. `Set.of` does not guarantee order, so it could
make tests flaky or break public interfaces.

Reviewers: Ken Huang <s7133700@gmail.com>, PoAn Yang
 <payang@apache.org>, Chia-Ping Tsai <chia7712@gmail.com>
2025-06-11 18:36:14 +08:00
..
api KAFKA-15995: Adding KIP-877 support to Connect (#17804) 2025-02-11 18:27:15 +01:00
basic-auth-extension MINOR: Cleanup simplify set initialization with Set.of (#19925) 2025-06-11 18:36:14 +08:00
file/src KAFKA-19137 Use `StandardCharsets.UTF_8` instead of `StandardCharsets.UTF_8.name()` (#19464) 2025-04-15 23:44:00 +08:00
json MINOR: Cleanup simplify set initialization with Set.of (#19925) 2025-06-11 18:36:14 +08:00
mirror/src MINOR: Cleanup simplify set initialization with Set.of (#19925) 2025-06-11 18:36:14 +08:00
mirror-client/src MINOR: Cleanup simplify set initialization with Set.of (#19925) 2025-06-11 18:36:14 +08:00
runtime/src MINOR: Cleanup simplify set initialization with Set.of (#19925) 2025-06-11 18:36:14 +08:00
test-plugins/src/main MINOR: Add javadoc for Connect public packages/classes (#16404) 2024-06-21 10:23:35 +02:00
transforms/src MINOR: Fix typos in multiple files (#19102) 2025-03-05 14:27:32 +00:00