Simplification in EvalUtils.optionMap

--
MOS_MIGRATED_REVID=95106558
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/EvalUtils.java b/src/main/java/com/google/devtools/build/lib/syntax/EvalUtils.java
index 1287fc7..c3e23f3 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/EvalUtils.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/EvalUtils.java
@@ -717,28 +717,24 @@
   /**
    * Build a map of kwarg arguments from a list, removing null-s or None-s.
    *
-   * @param init a series of key, value pairs (as consecutive arguments), and optionally
-   *   a lone map at the end, as in {@code optionMap(k1, v1, k2, v2, k3, v3, map)}
-   *   where each key is a String, each value is an arbitrary Objet, and the map
-   *   must be a {@code Map<String, Object>}.
+   * @param init a series of key, value pairs (as consecutive arguments)
+   *   as in {@code optionMap(k1, v1, k2, v2, k3, v3, map)}
+   *   where each key is a String, each value is an arbitrary Objet.
    * @return a {@code Map<String, Object>} that has all the specified entries,
    *   where key, value pairs appearing earlier have precedence,
    *   i.e. {@code k1, v1} may override {@code k3, v3}.
    *
-   * Ignore any entry the key or value of which is null or None.
+   * Ignore any entry where the value is null or None.
+   * Keys cannot be null.
    */
   @SuppressWarnings("unchecked")
   public static ImmutableMap<String, Object> optionMap(Object... init) {
     ImmutableMap.Builder<String, Object> b = new ImmutableMap.Builder<>();
-    int l = init.length;
-    if (l % 2 == 1) { // If there's an odd number of argument, the last one is a Map.
-      l--;
-      b.putAll((Map<String, Object>) init[l]);
-    }
-    for (int i = l - 2; i >= 0; i -= 2) {
-      String key = (String) init[i];
+    Preconditions.checkState(init.length % 2 == 0);
+    for (int i = init.length - 2; i >= 0; i -= 2) {
+      String key = (String) Preconditions.checkNotNull(init[i]);
       Object value = init[i + 1];
-      if (!(isNullOrNone(key) || isNullOrNone(value))) {
+      if (!isNullOrNone(value)) {
         b.put(key, value);
       }
     }