Internal routine used by format.

@throws IllegalArgumentException if an argument in the
<code>arguments</code> map is not of the type
expected by the format element(s) that use it.
774655
private void format(Object[] arguments, Map<String, Object> argsMap,
                        AppendableWrapper dest, FieldPosition fp) {
        if (arguments != null && msgPattern.hasNamedArguments()) {
            throw new IllegalArgumentException(
                "This method is not available in MessageFormat objects " +
                "that use alphanumeric argument names.");
        }
        format(0, null, arguments, argsMap, dest, fp);
    }
930695
private Map<String, Object> handleArgDefine(final String arg, final Deque<String> args) {
        /*
         * Interestingly enough, we get to here when a user uses -Dname=value.
         * However, in some cases, the OS goes ahead and parses this out to args
         * {"-Dname", "value"} so instead of parsing on "=", we just make the
         * "-D" characters go away and skip one argument forward.
         *
         * I don't know how to predict when the JDK is going to help or not, so
         * we simply look for the equals sign.
         */
        final Map.Entry<String, String> entry = parse(arg.substring(2), args);
        if (entry.getValue() == null) {
            throw new BuildException("Missing value for property " + entry.getKey());
        }

        if (RESERVED_PROPERTIES.containsKey(entry.getKey())) {
            throw new BuildException("Property " + entry.getKey() + " cannot be set with -D, use " + RESERVED_PROPERTIES.get(entry.getKey()) + " instead");
        }
        return ImmutableMap.of(entry.getKey(), entry.getValue());
    }
270911
@SuppressWarnings("unchecked")
    protected <T> T cast(Object arg, Class<T> type) {
        if (arg == null) {
            throw new NullPointerException("Argument is null");
        }
        if (!type.isInstance(arg)) {
            throw FormatException.illegalFormat(getFormatName(), arg.getClass());
        }
        return (T) arg;
    }
1044869
private void checkArgument(boolean argument, String msg, Object... args) {
        if (!argument) {
            throw new IllegalArgumentException(String.format(msg, args));
        }
    }
1017188
public final void addArgument(final String name, final Object value) {
        if (name == null) {
            throw new IllegalArgumentException("The argument 'name' cannot be null!");
        }
        if (value == null) {
            throw new IllegalArgumentException("The argument 'value' cannot be null!");
        }
        arguments.put(name.trim(), value);
    }
349337
public <Z> Type map(TypeMapping<Z> mapping, Z arg) {
        return mapping.visit(this, arg);
    }
1099869
public static void containsKey( Map<?, ?> argument,
                                    Object key,
                                    String name ) {
        isNotNull(argument, name);
        if (!argument.containsKey(key)) {
            throw new IllegalArgumentException(CommonI18n.argumentDidNotContainKey.text(name, getObjectName(key)));
        }
    }
501250
public @NotNull LinkArgs properties(Map<String, Object> map) {
    if (map == null) {
      throw new IllegalArgumentException("Map argument must not be null.");
    }
    getProperties().putAll(map);
    return this;
  }
145863
public final void arguments() throws RecognitionException {
		int arguments_StartIndex = input.index();

		try {
			if ( state.backtracking>0 && alreadyParsedRule(input, 140) ) { return; }

			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1297:5: ( '(' ( expressionList )? ')' )
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1297:7: '(' ( expressionList )? ')'
			{
			match(input,36,FOLLOW_36_in_arguments6395); if (state.failed) return;
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1297:11: ( expressionList )?
			int alt192=2;
			int LA192_0 = input.LA(1);
			if ( ((LA192_0 >= CharacterLiteral && LA192_0 <= DecimalLiteral)||LA192_0==FloatingPointLiteral||(LA192_0 >= HexLiteral && LA192_0 <= Identifier)||(LA192_0 >= OctalLiteral && LA192_0 <= StringLiteral)||LA192_0==29||LA192_0==36||(LA192_0 >= 40 && LA192_0 <= 41)||(LA192_0 >= 44 && LA192_0 <= 45)||LA192_0==53||LA192_0==65||LA192_0==67||(LA192_0 >= 70 && LA192_0 <= 71)||LA192_0==77||(LA192_0 >= 79 && LA192_0 <= 80)||LA192_0==82||LA192_0==85||LA192_0==92||LA192_0==94||(LA192_0 >= 97 && LA192_0 <= 98)||LA192_0==105||LA192_0==108||LA192_0==111||LA192_0==115||LA192_0==118||LA192_0==126) ) {
				alt192=1;
			}
			switch (alt192) {
				case 1 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1297:11: expressionList
					{
					pushFollow(FOLLOW_expressionList_in_arguments6397);
					expressionList();
					state._fsp--;
					if (state.failed) return;
					}
					break;

			}

			match(input,37,FOLLOW_37_in_arguments6400); if (state.failed) return;
			}

		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
		}
		finally {
			// do for sure before leaving
			if ( state.backtracking>0 ) { memoize(input, 140, arguments_StartIndex); }

		}
	}
222012
static <T> PathMapped<T> of(PathMapping mapping, PathMappingResult mappingResult, T value) {
        requireNonNull(mapping, "mapping");
        requireNonNull(mappingResult, "mappingResult");
        requireNonNull(value, "value");
        if (!mappingResult.isPresent()) {
            throw new IllegalArgumentException("mappingResult: " + mappingResult + " (must be present)");
        }

        return new PathMapped<>(mapping, mappingResult, value);
    }
735015
public void putMap(Map<String, String> map)
    {
        if (map == null) {
            putNumber1(0);
        }
        else {
            Utils.checkArgument(map.size() < 256, "Map has to be smaller than 256 elements");
            putNumber1(map.size());
            for (Entry<String, String> entry : map.entrySet()) {
                if (entry.getKey().contains("=")) {
                    throw new IllegalArgumentException("Keys cannot contain '=' sign. " + entry);
                }
                if (entry.getValue().contains("=")) {
                    throw new IllegalArgumentException("Values cannot contain '=' sign. " + entry);
                }
                String val = entry.getKey() + "=" + entry.getValue();
                putString(val);
            }
        }
    }
1118969
static void requireArgument(boolean expression, String template, @Nullable Object... args) {
    if (!expression) {
      throw new IllegalArgumentException(String.format(template, args));
    }
  }
1018096
public static void main(String[] args) throws Exception {

		boolean valid = true;
		boolean requiredArguments = false;

		String imageFormat = null;
		boolean rawImage = false;
		File inputDirectory = null;
		TileFormatType tileType = null;
		File geoPackageFile = null;
		String tileTable = null;

		for (int i = 0; valid && i < args.length; i++) {

			String arg = args[i];

			// Handle optional arguments
			if (arg.startsWith(ARGUMENT_PREFIX)) {

				String argument = arg.substring(ARGUMENT_PREFIX.length());

				switch (argument) {

				case ARGUMENT_IMAGE_FORMAT:
					if (i < args.length) {
						imageFormat = args[++i];
					} else {
						valid = false;
						System.out.println("Error: Image Format argument '"
								+ arg + "' must be followed by a image format");
					}
					break;

				case ARGUMENT_RAW_IMAGE:
					rawImage = true;
					break;

				default:
					valid = false;
					System.out.println("Error: Unsupported arg: '" + arg + "'");
				}

			} else {
				// Set required arguments in order
				if (inputDirectory == null) {
					inputDirectory = new File(arg);
				} else if (tileType == null) {
					tileType = TileFormatType.valueOf(arg.toUpperCase());
				} else if (geoPackageFile == null) {
					geoPackageFile = new File(arg);
				} else if (tileTable == null) {
					tileTable = arg;
					requiredArguments = true;
				} else {
					valid = false;
					System.out.println("Error: Unsupported extra argument: "
							+ arg);
				}
			}
		}

		if (!valid || !requiredArguments) {
			printUsage();
		} else {
			// Read the tiles
			try {
				readTiles(geoPackageFile, tileTable, inputDirectory,
						imageFormat, tileType, rawImage);
			} catch (Exception e) {
				printUsage();
				throw e;
			}
		}

	}
1323484
public static <K, V, R extends Map<K, V>> R rejectMapOnEntry(
            Map<K, V> map,
            final Predicate2<? super K, ? super V> predicate,
            final R target)
    {
        MapIterate.forEachKeyValue(map, new Procedure2<K, V>()
        {
            public void value(K argument1, V argument2)
            {
                if (!predicate.accept(argument1, argument2))
                {
                    target.put(argument1, argument2);
                }
            }
        });

        return target;
    }
39231
public static void checkArgument(boolean b, @Nullable String errorMessageTemplate, char p1) {
    if (!b) {
      throw new IllegalArgumentException(format(errorMessageTemplate, p1));
    }
  }
737873
@NotNull
    protected Map<String, Object> toTypeArguments(@NotNull Map<String, ClassElement> typeArguments) {
        final LinkedHashMap<String, Object> map = new LinkedHashMap<>(typeArguments.size());
        for (Map.Entry<String, ClassElement> entry : typeArguments.entrySet()) {
            final ClassElement ce = entry.getValue();
            final Map<String, ClassElement> subArgs = ce.getTypeArguments();
            if (CollectionUtils.isNotEmpty(subArgs)) {
                map.put(entry.getKey(), toTypeArguments(subArgs));
            } else {
                final Type typeReference = getTypeForElement(ce);
                map.put(entry.getKey(), typeReference);
            }
        }

        return map;
    }
251445
public final void setArgument(final String key, final Object value) {

		if (key != null && value != null) {
			this.arguments.put(key, value);
		}
	}