Simpler constant definitions.

This commit is contained in:
Gary Gregory 2021-12-08 09:18:25 -05:00
parent bdaaeb5b1b
commit a71bab967a
7 changed files with 7 additions and 49 deletions

View File

@ -86,7 +86,7 @@ public class ArrayUtils {
/** /**
* An empty immutable {@code Class} array. * An empty immutable {@code Class} array.
*/ */
public static final Class<?>[] EMPTY_CLASS_ARRAY = new Class[0]; public static final Class<?>[] EMPTY_CLASS_ARRAY = {};
/** /**
* An empty immutable {@code double} array. * An empty immutable {@code double} array.

View File

@ -44,7 +44,7 @@ public final class ImmutablePair<L, R> extends Pair<L, R> {
* *
* @since 3.10. * @since 3.10.
*/ */
public static final ImmutablePair<?, ?>[] EMPTY_ARRAY = new ImmutablePair[0]; public static final ImmutablePair<?, ?>[] EMPTY_ARRAY = {};
/** /**
* An immutable pair of nulls. * An immutable pair of nulls.

View File

@ -44,7 +44,7 @@ public final class ImmutableTriple<L, M, R> extends Triple<L, M, R> {
* *
* @since 3.10. * @since 3.10.
*/ */
public static final ImmutableTriple<?, ?, ?>[] EMPTY_ARRAY = new ImmutableTriple[0]; public static final ImmutableTriple<?, ?, ?>[] EMPTY_ARRAY = {};
/** /**
* An immutable triple of nulls. * An immutable triple of nulls.

View File

@ -39,7 +39,7 @@ public class MutablePair<L, R> extends Pair<L, R> {
* *
* @since 3.10. * @since 3.10.
*/ */
public static final MutablePair<?, ?>[] EMPTY_ARRAY = new MutablePair[0]; public static final MutablePair<?, ?>[] EMPTY_ARRAY = {};
/** Serialization version */ /** Serialization version */
private static final long serialVersionUID = 4954918890077093841L; private static final long serialVersionUID = 4954918890077093841L;

View File

@ -39,7 +39,7 @@ public class MutableTriple<L, M, R> extends Triple<L, M, R> {
* *
* @since 3.10. * @since 3.10.
*/ */
public static final MutableTriple<?, ?, ?>[] EMPTY_ARRAY = new MutableTriple[0]; public static final MutableTriple<?, ?, ?>[] EMPTY_ARRAY = {};
/** Serialization version */ /** Serialization version */
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@ -40,27 +40,6 @@
*/ */
public abstract class Pair<L, R> implements Map.Entry<L, R>, Comparable<Pair<L, R>>, Serializable { public abstract class Pair<L, R> implements Map.Entry<L, R>, Comparable<Pair<L, R>>, Serializable {
private static final class PairAdapter<L, R> extends Pair<L, R> {
private static final long serialVersionUID = 1L;
@Override
public L getLeft() {
return null;
}
@Override
public R getRight() {
return null;
}
@Override
public R setValue(final R value) {
return null;
}
}
/** Serialization version */ /** Serialization version */
private static final long serialVersionUID = 4954918890077093841L; private static final long serialVersionUID = 4954918890077093841L;
@ -72,7 +51,7 @@ public R setValue(final R value) {
* *
* @since 3.10. * @since 3.10.
*/ */
public static final Pair<?, ?>[] EMPTY_ARRAY = new PairAdapter[0]; public static final Pair<?, ?>[] EMPTY_ARRAY = {};
/** /**
* Returns the empty array singleton that can be assigned without compiler warning. * Returns the empty array singleton that can be assigned without compiler warning.

View File

@ -39,27 +39,6 @@
*/ */
public abstract class Triple<L, M, R> implements Comparable<Triple<L, M, R>>, Serializable { public abstract class Triple<L, M, R> implements Comparable<Triple<L, M, R>>, Serializable {
private static final class TripleAdapter<L, M, R> extends Triple<L, M, R> {
private static final long serialVersionUID = 1L;
@Override
public L getLeft() {
return null;
}
@Override
public M getMiddle() {
return null;
}
@Override
public R getRight() {
return null;
}
}
/** Serialization version */ /** Serialization version */
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -71,7 +50,7 @@ public R getRight() {
* *
* @since 3.10. * @since 3.10.
*/ */
public static final Triple<?, ?, ?>[] EMPTY_ARRAY = new TripleAdapter[0]; public static final Triple<?, ?, ?>[] EMPTY_ARRAY = {};
/** /**
* Returns the empty array singleton that can be assigned without compiler warning. * Returns the empty array singleton that can be assigned without compiler warning.