Skip to content

Commit

Permalink
Merge 869a26c into c4d0dbc
Browse files Browse the repository at this point in the history
  • Loading branch information
PascalSchumacher committed Nov 18, 2018
2 parents c4d0dbc + 869a26c commit 3c38163
Show file tree
Hide file tree
Showing 84 changed files with 908 additions and 905 deletions.
1 change: 1 addition & 0 deletions checkstyle.xml
Expand Up @@ -55,5 +55,6 @@ limitations under the License.
<module name="LeftCurly"/>
<module name="NeedBraces"/>
<module name="RightCurly"/>
<module name="WhitespaceAfter"/>
</module>
</module>
34 changes: 17 additions & 17 deletions src/main/java/org/apache/commons/lang3/ArrayUtils.java
Expand Up @@ -244,7 +244,7 @@ public static Map<Object, Object> toMap(final Object[] array) {
for (int i = 0; i < array.length; i++) {
final Object object = array[i];
if (object instanceof Map.Entry<?, ?>) {
final Map.Entry<?,?> entry = (Map.Entry<?,?>) object;
final Map.Entry<?, ?> entry = (Map.Entry<?, ?>) object;
map.put(entry.getKey(), entry.getValue());
} else if (object instanceof Object[]) {
final Object[] entry = (Object[]) object;
Expand Down Expand Up @@ -275,7 +275,7 @@ public static Map<Object, Object> toMap(final Object[] array) {
return new T[size]; // compiler error here
}
public static &lt;T&gt; T[] createAnArray(int size) {
return (T[])new Object[size]; // ClassCastException at runtime
return (T[]) new Object[size]; // ClassCastException at runtime
}
* </pre>
*
Expand Down Expand Up @@ -877,7 +877,7 @@ public static Boolean[] nullToEmpty(final Boolean[] array) {
* {@code Date}, the following usage is envisaged:
*
* <pre>
* Date[] someDates = (Date[])ArrayUtils.subarray(allDates, 2, 5);
* Date[] someDates = (Date[]) ArrayUtils.subarray(allDates, 2, 5);
* </pre>
*
* @param <T> the component type of the array
Expand Down Expand Up @@ -4748,19 +4748,19 @@ public static Object toPrimitive(final Object array) {
}
final Class<?> ct = array.getClass().getComponentType();
final Class<?> pt = ClassUtils.wrapperToPrimitive(ct);
if(Integer.TYPE.equals(pt)) {
if (Integer.TYPE.equals(pt)) {
return toPrimitive((Integer[]) array);
}
if(Long.TYPE.equals(pt)) {
if (Long.TYPE.equals(pt)) {
return toPrimitive((Long[]) array);
}
if(Short.TYPE.equals(pt)) {
if (Short.TYPE.equals(pt)) {
return toPrimitive((Short[]) array);
}
if(Double.TYPE.equals(pt)) {
if (Double.TYPE.equals(pt)) {
return toPrimitive((Double[]) array);
}
if(Float.TYPE.equals(pt)) {
if (Float.TYPE.equals(pt)) {
return toPrimitive((Float[]) array);
}
return array;
Expand Down Expand Up @@ -5387,7 +5387,7 @@ public static <T> T[] add(final T[] array, final T element) {
* @since 2.1
*/
public static boolean[] add(final boolean[] array, final boolean element) {
final boolean[] newArray = (boolean[])copyArrayGrow1(array, Boolean.TYPE);
final boolean[] newArray = (boolean[]) copyArrayGrow1(array, Boolean.TYPE);
newArray[newArray.length - 1] = element;
return newArray;
}
Expand All @@ -5414,7 +5414,7 @@ public static boolean[] add(final boolean[] array, final boolean element) {
* @since 2.1
*/
public static byte[] add(final byte[] array, final byte element) {
final byte[] newArray = (byte[])copyArrayGrow1(array, Byte.TYPE);
final byte[] newArray = (byte[]) copyArrayGrow1(array, Byte.TYPE);
newArray[newArray.length - 1] = element;
return newArray;
}
Expand All @@ -5441,7 +5441,7 @@ public static byte[] add(final byte[] array, final byte element) {
* @since 2.1
*/
public static char[] add(final char[] array, final char element) {
final char[] newArray = (char[])copyArrayGrow1(array, Character.TYPE);
final char[] newArray = (char[]) copyArrayGrow1(array, Character.TYPE);
newArray[newArray.length - 1] = element;
return newArray;
}
Expand All @@ -5468,7 +5468,7 @@ public static char[] add(final char[] array, final char element) {
* @since 2.1
*/
public static double[] add(final double[] array, final double element) {
final double[] newArray = (double[])copyArrayGrow1(array, Double.TYPE);
final double[] newArray = (double[]) copyArrayGrow1(array, Double.TYPE);
newArray[newArray.length - 1] = element;
return newArray;
}
Expand All @@ -5495,7 +5495,7 @@ public static double[] add(final double[] array, final double element) {
* @since 2.1
*/
public static float[] add(final float[] array, final float element) {
final float[] newArray = (float[])copyArrayGrow1(array, Float.TYPE);
final float[] newArray = (float[]) copyArrayGrow1(array, Float.TYPE);
newArray[newArray.length - 1] = element;
return newArray;
}
Expand All @@ -5522,7 +5522,7 @@ public static float[] add(final float[] array, final float element) {
* @since 2.1
*/
public static int[] add(final int[] array, final int element) {
final int[] newArray = (int[])copyArrayGrow1(array, Integer.TYPE);
final int[] newArray = (int[]) copyArrayGrow1(array, Integer.TYPE);
newArray[newArray.length - 1] = element;
return newArray;
}
Expand All @@ -5549,7 +5549,7 @@ public static int[] add(final int[] array, final int element) {
* @since 2.1
*/
public static long[] add(final long[] array, final long element) {
final long[] newArray = (long[])copyArrayGrow1(array, Long.TYPE);
final long[] newArray = (long[]) copyArrayGrow1(array, Long.TYPE);
newArray[newArray.length - 1] = element;
return newArray;
}
Expand Down Expand Up @@ -8681,8 +8681,8 @@ public static void shuffle(final double[] array, final Random random) {
* @return Whether the given index is safely-accessible in the given array
* @since 3.8
*/
public static <T> boolean isArrayIndexValid(T[] array, int index){
if(getLength(array) == 0 || array.length <= index){
public static <T> boolean isArrayIndexValid(T[] array, int index) {
if (getLength(array) == 0 || array.length <= index) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/apache/commons/lang3/CharSet.java
Expand Up @@ -132,7 +132,7 @@ public class CharSet implements Serializable {
* <p>There are two ways to add a literal negation character ({@code ^}):</p>
* <ul>
* <li>As the last character in a string, e.g. {@code CharSet.getInstance("a-z^")}</li>
* <li>As a separate element, e.g. {@code CharSet.getInstance("^","a-z")}</li>
* <li>As a separate element, e.g. {@code CharSet.getInstance("^", "a-z")}</li>
* </ul>
*
* <p>Examples using the negation character:</p>
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/apache/commons/lang3/Conversion.java
Expand Up @@ -359,7 +359,7 @@ public static char binaryToHexDigitMsb0_4bits(final boolean[] src) {
* ordering.
* </p>
* <p>
* (1, 0, 0, 0) is converted as follow: '8' (1,0,0,1,1,0,1,0) with srcPos = 3 is converted
* (1, 0, 0, 0) is converted as follow: '8' (1, 0, 0, 1, 1, 0, 1, 0) with srcPos = 3 is converted
* to 'D'
* </p>
*
Expand Down Expand Up @@ -407,7 +407,7 @@ public static char binaryToHexDigitMsb0_4bits(final boolean[] src, final int src
* bit ordering to a hexadecimal digit.
* </p>
* <p>
* (1, 0, 0, 0) is converted as follow: '8' (1,0,0,0,0,0,0,0, 0,0,0,0,0,1,0,0) is converted
* (1, 0, 0, 0) is converted as follow: '8' (1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0) is converted
* to '4'
* </p>
*
Expand All @@ -426,8 +426,8 @@ public static char binaryBeMsb0ToHexDigit(final boolean[] src) {
* hexadecimal digit.
* </p>
* <p>
* (1, 0, 0, 0) with srcPos = 0 is converted as follow: '8' (1,0,0,0,0,0,0,0,
* 0,0,0,1,0,1,0,0) with srcPos = 2 is converted to '5'
* (1, 0, 0, 0) with srcPos = 0 is converted as follow: '8' (1, 0, 0, 0, 0, 0, 0, 0,
* 0, 0, 0, 1, 0, 1, 0, 0) with srcPos = 2 is converted to '5'
* </p>
*
* @param src the binary to convert
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/apache/commons/lang3/LocaleUtils.java
Expand Up @@ -194,8 +194,8 @@ private static boolean isNumericAreaCode(final String str) {
* a locale search.</p>
*
* <pre>
* localeLookupList(Locale("fr","CA","xxx"))
* = [Locale("fr","CA","xxx"), Locale("fr","CA"), Locale("fr")]
* localeLookupList(Locale("fr", "CA", "xxx"))
* = [Locale("fr", "CA", "xxx"), Locale("fr", "CA"), Locale("fr")]
* </pre>
*
* @param locale the locale to start from
Expand All @@ -212,7 +212,7 @@ public static List<Locale> localeLookupList(final Locale locale) {
*
* <pre>
* localeLookupList(Locale("fr", "CA", "xxx"), Locale("en"))
* = [Locale("fr","CA","xxx"), Locale("fr","CA"), Locale("fr"), Locale("en"]
* = [Locale("fr", "CA", "xxx"), Locale("fr", "CA"), Locale("fr"), Locale("en"]
* </pre>
*
* <p>The result list begins with the most specific locale, then the
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/org/apache/commons/lang3/ObjectUtils.java
Expand Up @@ -69,7 +69,7 @@ public class ObjectUtils {
/**
* <p>{@code ObjectUtils} instances should NOT be constructed in
* standard programming. Instead, the static methods on the class should
* be used, such as {@code ObjectUtils.defaultIfNull("a","b");}.</p>
* be used, such as {@code ObjectUtils.defaultIfNull("a", "b");}.</p>
*
* <p>This constructor is public to permit tools that require a JavaBean
* instance to operate.</p>
Expand All @@ -96,7 +96,7 @@ public ObjectUtils() {
* ObjectUtils.isEmpty("") = true
* ObjectUtils.isEmpty("ab") = false
* ObjectUtils.isEmpty(new int[]{}) = true
* ObjectUtils.isEmpty(new int[]{1,2,3}) = false
* ObjectUtils.isEmpty(new int[]{1, 2, 3}) = false
* ObjectUtils.isEmpty(1234) = false
* </pre>
*
Expand Down Expand Up @@ -140,7 +140,7 @@ public static boolean isEmpty(final Object object) {
* ObjectUtils.isNotEmpty("") = false
* ObjectUtils.isNotEmpty("ab") = true
* ObjectUtils.isNotEmpty(new int[]{}) = false
* ObjectUtils.isNotEmpty(new int[]{1,2,3}) = true
* ObjectUtils.isNotEmpty(new int[]{1, 2, 3}) = true
* ObjectUtils.isNotEmpty(1234) = true
* </pre>
*
Expand Down Expand Up @@ -365,8 +365,8 @@ public static int hashCode(final Object obj) {
* ObjectUtils.hashCodeMulti() = 1
* ObjectUtils.hashCodeMulti((Object[]) null) = 1
* ObjectUtils.hashCodeMulti(a) = 31 + a.hashCode()
* ObjectUtils.hashCodeMulti(a,b) = (31 + a.hashCode()) * 31 + b.hashCode()
* ObjectUtils.hashCodeMulti(a,b,c) = ((31 + a.hashCode()) * 31 + b.hashCode()) * 31 + c.hashCode()
* ObjectUtils.hashCodeMulti(a, b) = (31 + a.hashCode()) * 31 + b.hashCode()
* ObjectUtils.hashCodeMulti(a, b, c) = ((31 + a.hashCode()) * 31 + b.hashCode()) * 31 + c.hashCode()
* </pre>
*
* @param objects the objects to obtain the hash code of, may be {@code null}
Expand Down Expand Up @@ -560,7 +560,7 @@ public static String toString(final Object obj) {
* ObjectUtils.toString(Boolean.TRUE, "null") = "true"
* </pre>
*
* @see StringUtils#defaultString(String,String)
* @see StringUtils#defaultString(String, String)
* @see String#valueOf(Object)
* @param obj the Object to {@code toString}, may be null
* @param nullStr the String to return if {@code null} input, may be null
Expand Down
Expand Up @@ -293,7 +293,7 @@ public static String random(final int count, final int start, final int end, fin
* default source of randomness.</p>
*
* <p>This method has exactly the same semantics as
* {@link #random(int,int,int,boolean,boolean,char[],Random)}, but
* {@link #random(int, int, int, boolean, boolean, char[], Random)}, but
* instead of using an externally supplied source of randomness, it uses
* the internal static {@link Random} instance.</p>
*
Expand Down
Expand Up @@ -134,7 +134,7 @@ public static <T extends Serializable> T roundtrip(final T msg) {
*/
public static void serialize(final Serializable obj, final OutputStream outputStream) {
Validate.isTrue(outputStream != null, "The OutputStream must not be null");
try (ObjectOutputStream out = new ObjectOutputStream(outputStream)){
try (ObjectOutputStream out = new ObjectOutputStream(outputStream)) {
out.writeObject(obj);
} catch (final IOException ex) {
throw new SerializationException(ex);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/apache/commons/lang3/StringEscapeUtils.java
Expand Up @@ -260,7 +260,7 @@ static class CsvEscaper extends CharSequenceTranslator {
@Override
public int translate(final CharSequence input, final int index, final Writer out) throws IOException {

if(index != 0) {
if (index != 0) {
throw new IllegalStateException("CsvEscaper should never reach the [1] index");
}

Expand Down Expand Up @@ -393,7 +393,7 @@ static class CsvUnescaper extends CharSequenceTranslator {
@Override
public int translate(final CharSequence input, final int index, final Writer out) throws IOException {

if(index != 0) {
if (index != 0) {
throw new IllegalStateException("CsvUnescaper should never reach the [1] index");
}

Expand Down

0 comments on commit 3c38163

Please sign in to comment.