Returns a throwable if the last argument is one.

@param arguments
Passed arguments
@return Last argument as throwable or {@code null}
779633
private static Throwable extractThrowable(final Object[] arguments) {
		return arguments.length == 0 ? null : extractThrowable(arguments[arguments.length - 1]);
	}
960610
@Incubating
    public static <T> T assertArgThrowing(ThrowingConsumer<T> throwingConsumer) {
        argThat(throwingConsumer.uncheck());
        return handyReturnValues.returnForConsumerLambdaChecked(throwingConsumer);
    }
285394
public static Class<?>[] getParamTypes(Object... arguments)
    {
        Check.notNull(arguments);

        final Collection<Object> types = new ArrayList<>(arguments.length);
        for (final Object argument : arguments)
        {
            if (argument.getClass() == Class.class)
            {
                types.add(argument);
            }
            else
            {
                types.add(argument.getClass());
            }
        }
        final Class<?>[] typesArray = new Class<?>[types.size()];
        return types.toArray(typesArray);
    }
1226554
public static void warnWithException(Logger logger, String format, Object... arguments) {
    if (logger.isDebugEnabled()) {
      logger.warn(format, arguments);
    } else {
      Object last = arguments[arguments.length - 1];
      if (last instanceof Throwable) {
        Throwable t = (Throwable) last;
        arguments[arguments.length - 1] = t.getClass().getSimpleName() + ": " + t.getMessage();
        logger.warn(format + " ({})", arguments);
      } else {
        // Should only be called with an exception as last argument, but handle gracefully anyway
        logger.warn(format, arguments);
      }
    }
  }
4381
@Override
  protected HashMap<String, Object> getDistribution(String argument) {
    HashMap<String, Object> result = new LinkedHashMap<>();
    Long start = null;
    Long end = null;
    Long step = null;
    Integer number = null;
    if (argument != null) {
      Matcher m = fpArgument.matcher(argument);
      // get settings
      while (m.find()) {
        if (m.group(1).trim().equals("start")) {
          start = Long.parseLong(m.group(2));
        } else if (m.group(1).trim().equals("end")) {
          end = Long.parseLong(m.group(2));
        } else if (m.group(1).trim().equals("step")) {
          step = Long.parseLong(m.group(2));
        } else if (m.group(1).trim().equals("number")) {
          number = Integer.parseInt(m.group(2));
        }
      }
    }
    // always exactly one of (positive) number and (positive) step, other null
    if ((number == null || number < 1) && (step == null || step < 1)) {
      number = 10;
      step = null;
    } else if (step != null && step < 1) {
      step = null;
    } else if (number != null && number < 1) {
      number = null;
    } else if (step != null) {
      number = null;
    }
    // sanity checks start/end
    createStats();
    long tmpStart = Double.valueOf(Math.floor(stats.getMin())).longValue();
    long tmpEnd = Double.valueOf(Math.ceil(stats.getMax())).longValue();
    if (start != null && end != null && start > end) {
      return null;
    } else if (start != null && start > tmpEnd) {
      return null;
    } else if (end != null && end < tmpStart) {
      return null;
    }
    // check start and end
    if (start == null && end == null) {
      if (step == null) {
        step = -Math.floorDiv((tmpStart - tmpEnd - 1), number);
      }
      number = Long.valueOf(-Math.floorDiv((tmpStart - tmpEnd - 1), step))
          .intValue();
      start = tmpStart;
      end = start + (number * step);
    } else if (start == null) {
      if (step == null) {
        step = -Math.floorDiv((tmpStart - end - 1), number);
      }
      number = Long.valueOf(-Math.floorDiv((tmpStart - end - 1), step))
          .intValue();
      start = end - (number * step);
    } else if (end == null) {
      if (step == null) {
        step = -Math.floorDiv((start - tmpEnd - 1), number);
      }
      number = Long.valueOf(-Math.floorDiv((start - tmpEnd - 1), step))
          .intValue();
      end = start + (number * step);
    } else {
      if (step == null) {
        step = -Math.floorDiv((start - end - 1), number);
      }
      number = Long.valueOf(-Math.floorDiv((start - end - 1), step)).intValue();
    }
    long[] list = new long[number];
    for (Long v : fullValues) {
      if (v >= start && v <= end) {
        int i = Long.valueOf(Math.floorDiv((v - start), step)).intValue();
        list[i]++;
      }
    }
    for (int i = 0; i < number; i++) {
      Long l = start + i * step;
      Long r = Math.min(end, l + step - 1);
      String key;
      if (step > 1 && r > l) {
        key = "[" + l + "," + r + "]";
      } else {
        key = "[" + l + "]";
      }
      result.put(key, list[i]);
    }
    return result;
  }
307630
static String getArgumentTypesAsString(Object... arguments) {
        StringBuilder argumentsAsString = new StringBuilder();
        final String noParameters = "<none>";
        if (arguments != null && arguments.length != 0) {
            for (int i = 0; i < arguments.length; i++) {
                String argumentName = null;
                Object argument = arguments[i];

                if (argument instanceof Class<?>) {
                    argumentName = ((Class<?>) argument).getName();
                } else if (argument instanceof Class<?>[] && arguments.length == 1) {
                    Class<?>[] argumentArray = (Class<?>[]) argument;
                    if (argumentArray.length > 0) {
                        for (int j = 0; j < argumentArray.length; j++) {
                            appendArgument(argumentsAsString, j,
                                    argumentArray[j] == null ? "null" : getUnproxyType(argumentArray[j]).getName(),
                                    argumentArray);
                        }
                        return argumentsAsString.toString();
                    } else {
                        argumentName = noParameters;
                    }
                } else if (argument == null) {
                    argumentName = "null";
                } else {
                    argumentName = getUnproxyType(argument).getName();
                }
                appendArgument(argumentsAsString, i, argumentName, arguments);
            }
        } else {
            argumentsAsString.append("<none>");
        }
        return argumentsAsString.toString();
    }
498891
function (arguments) {
                var argData = ArgumentHelpers.prepareCallback(arguments);
                var callback = argData.callback;
                var args = argData.arguments;
                if (callback) {
                    args.pop();
                }
                return args;
            }
893495
public static boolean checkArgs(String[] args) {
	if (args.length < 5) {
	    return false;
	}
	
	if (!(args[0].compareToIgnoreCase("-all") == 0 ||
		    args[0].compareToIgnoreCase("-trn") == 0 ||
		    args[0].compareToIgnoreCase("-tst") == 0) || 
		    args[0].compareToIgnoreCase("-cont") == 0) {
	    return false;
	}
	
	if (args[1].compareToIgnoreCase("-d") != 0) {
	    return false;
	}
	
	if (args[3].compareToIgnoreCase("-o") != 0)
		return false; 
	
	return true;
    }
1190304
public static Throwable getCause(Throwable thr) {
		Throwable cause = thr.getCause();
		while (cause != null && cause != thr && cause != cause.getCause() && cause.getCause() != null) {
			cause = cause.getCause();
		}
		return cause == null ? thr : cause;
	}
209153
public static <T extends CharSequence> T checkArgNotNullOrEmpty(final T arg, final String argNameOrErrorMsg) {
        if (N.isNullOrEmpty(arg)) {
            if (argNameOrErrorMsg.indexOf(' ') == N.INDEX_NOT_FOUND) {
                throw new IllegalArgumentException("'" + argNameOrErrorMsg + "' can not be null or empty");
            } else {
                throw new IllegalArgumentException(argNameOrErrorMsg);
            }
        }

        return arg;
    }
692251
private static void unwrapArgs(final Class<?>[] types, final Object[] args) {
        if (args == null) {
            return;
        }
        try {
            for (int i = 0; i < args.length; ++i) {
                args[i] = ReflectionHelper.unwrap(types[i], args[i]);
            }
        } catch (Exception e) {
            throw new IllegalArgumentException(e);
        }

    }
855710
protected static boolean typeCheckMethodArgumentWithGenerics(ClassNode parameterType, ClassNode argumentType, boolean lastArg) {
        if (UNKNOWN_PARAMETER_TYPE == argumentType) {
            // called with null
            return !isPrimitiveType(parameterType);
        }
        if (!isAssignableTo(argumentType, parameterType) && !lastArg) {
            // incompatible assignment
            return false;
        }
        if (!isAssignableTo(argumentType, parameterType) && lastArg) {
            if (parameterType.isArray()) {
                if (!isAssignableTo(argumentType, parameterType.getComponentType())) {
                    return false;
                }
            } else {
                return false;
            }
        }
        if (parameterType.isUsingGenerics() && argumentType.isUsingGenerics()) {
            GenericsType gt = GenericsUtils.buildWildcardType(parameterType);
            if (!gt.isCompatibleWith(argumentType)) {
                boolean samCoercion = isSAMType(parameterType) && argumentType.equals(CLOSURE_TYPE);
                if (!samCoercion) return false;
            }
        } else if (parameterType.isArray() && argumentType.isArray()) {
            // verify component type
            return typeCheckMethodArgumentWithGenerics(parameterType.getComponentType(), argumentType.getComponentType(), lastArg);
        } else if (lastArg && parameterType.isArray()) {
            // verify component type, but if we reach that point, the only possibility is that the argument is
            // the last one of the call, so we're in the cast of a vargs call
            // (otherwise, we face a type checker bug)
            return typeCheckMethodArgumentWithGenerics(parameterType.getComponentType(), argumentType, lastArg);
        }
        return true;
    }
271868
private void checkFactoryMethodArguments(int arguments) {
        for (Method m : typeDef.getMethods()) {
            int a = m.getArguments() != null ? m.getArguments().size() : 0;
            if (m.getName().equals(staticFactoryMethod) && a == arguments && m.isStatic()) {
                return;
            }
        }
        throw new IllegalArgumentException("No static method found on " + typeDef.getName() + " with name " + staticFactoryMethod + " and " + arguments + " arguments.");
    }
571565
private boolean isKwarg(Map<String, Object> arg) {
        Object kwarg = arg.get(KWARG_KEY);
        return kwarg != null
                && kwarg instanceof Boolean
                && ((Boolean) kwarg);
    }
346442
public  static <T> T at(int i, T[] args)
	{
		if(args == null || i < 0)
			return null;
		
		if(i>= args.length)
			return null;
		
		return args[i];
	}
715426
public CreateDevEndpointRequest withArguments(java.util.Map<String, String> arguments) {
        setArguments(arguments);
        return this;
    }
988486
public final SgArgument getLastArgument() {
        final int size = arguments.size();
        if (size == 0) {
            return null;
        }
        return arguments.get(size - 1);
    }