We can reduce casting here.
Change-Id: I1f06c042df0589f8cea9e06d2c91bc6f386bc89d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
@Beta
@SuppressWarnings("unchecked")
public static <T> @NonNull LeafNode<T> createNode(final NodeIdentifier identifier, final T value) {
- if (value instanceof byte[]) {
- return (LeafNode<T>) new ImmutableBinaryLeafNode(identifier, (byte[]) value);
+ if (value instanceof byte[] bytes) {
+ return (LeafNode<T>) new ImmutableBinaryLeafNode(identifier, bytes);
}
return new ImmutableLeafNode<>(identifier, value);
}