Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1decff4

Browse files
put back a method used by Agroal module
1 parent b5ccc16 commit 1decff4

File tree

1 file changed

+19
-0
lines changed
  • hibernate-core/src/main/java/org/hibernate/internal/util/collections

1 file changed

+19
-0
lines changed

‎hibernate-core/src/main/java/org/hibernate/internal/util/collections/ArrayHelper.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import java.lang.reflect.Array;
88
import java.util.ArrayList;
9+
import java.util.Arrays;
910
import java.util.Collection;
1011
import java.util.List;
1112
import java.util.function.Consumer;
@@ -55,6 +56,14 @@ public static int indexOf(Object[] array, int end, Object object) {
5556
return -1;
5657
}
5758

59+
@SuppressWarnings("unchecked")
60+
@AllowReflection
61+
public static <T> T[] filledArray(T value, Class<T> valueJavaType, int size) {
62+
final T[] array = (T[]) Array.newInstance( valueJavaType, size );
63+
Arrays.fill( array, value );
64+
return array;
65+
}
66+
5867
public static String[] toStringArray(Object[] objects) {
5968
int length = objects.length;
6069
String[] result = new String[length];
@@ -335,4 +344,14 @@ public static <T> void forEach(T[] array, Consumer<T> consumer) {
335344
}
336345
}
337346
}
347+
348+
/**
349+
* @deprecated Use {@link Array#newInstance(Class, int)} instead.
350+
*/
351+
@Deprecated
352+
@SuppressWarnings("unchecked")
353+
@AllowReflection
354+
public static <T> T[] newInstance(Class<T> elementType, int length) {
355+
return (T[]) Array.newInstance( elementType, length );
356+
}
338357
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /