RFR: 8301042: Need methods to check null elements in an array or a collection [v4]

Tingjun Yuan duke at openjdk.org
Sun Jan 29 04:53:27 UTC 2023


> Adding the following methods to check the nullity of elements of an array or a collection:
> 
> 
> java.util.Arrays:
> public static <E> E[] requireNoNulls(E[] array)
> public static <E> E[] requireNoNulls(E[] array, String message)
> public static <E> E[] requireNoNulls(E[] array, IntFunction<String> messageGenerator)
> public static <E> E[] requireNoNullsCopied(E[] array)
> public static <E> E[] requireNoNullsCopied(E[] array, IntFunction<String> messageGenerator)
> public static <E> E[] requireNoNullsCopied(E[] array, String message)
> 
> java.util.Collections:
> public static <C extends Iterable<?>> C requireNoNulls(C collection)
> public static <M extends Map<?, ?>> M requireNoNulls(M map)
> public static <C extends Iterable<?>> C requireNoNulls(C collection, String message)
> public static <M extends Map<?, ?>> M requireNoNulls(M map, String message)
> public static <C extends Iterable<?>> C requireNoNulls(C collection, Supplier<String> messageSupplier)
> public static <M extends Map<?, ?>> M requireNoNulls(M map, Supplier<String> messageSupplier)
> public static <L extends List<?>> L requireNoNulls(L list, IntFunction<String> messageGenerator)

Tingjun Yuan has updated the pull request incrementally with two additional commits since the last revision:

 - Fix the type parameter doc
 - Add `replace` method

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/12276/files
  - new: https://git.openjdk.org/jdk/pull/12276/files/11a7e87b..3744b35d

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=12276&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=12276&range=02-03

  Stats: 34 lines in 1 file changed: 34 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/12276.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/12276/head:pull/12276

PR: https://git.openjdk.org/jdk/pull/12276


More information about the core-libs-dev mailing list