Drops the first array item in the passed array.
If the passed array is null or empty, returns an empty array
@param args The array to shift
@return the shifted array
429057
private static String[] shift(String[] args) {
    if(args==null || args.length==0 | args.length==1) return new String[0];
    String[] newArgs = new String[args.length-1];
    System.arraycopy(args, 1, newArgs, 0, newArgs.length);
    return newArgs;
  }
474038
private static void shiftArray(char [] dest,int start, int e, char subChar){
        int w = e;
        int r = e;
        while (--r >= start) {
          char ch = dest[r];
          if (ch != subChar) {
            --w;
            if (w != r) {
              dest[w] = ch;
            }
          }
        }
   }
295745
public static <T extends Comparable<T>> List<T> lcs(List<T> arg0, List<T> arg1) {
        if (arg0 == null || arg1 == null) {
            return Collections.emptyList();
        }
        return lcs(arg0, arg1, 0, 0);
    }
853657
public static <T> T[] remove(final T[] array, final T target) {

    if (array == null) {
      return null;
    }
    int count = count(array, target);
    if (count > 0) {
      @SuppressWarnings("unchecked")
      T[] newArray = (T[]) buildArray(array.getClass().getComponentType(), array.length - count,
        null);
      int index = 0;
      for (T element : array) {
        if (JudgeUtils.notSame(element, target)) {
          newArray[index++] = element;
        }
      }
      return newArray;
    }
    return array;
  }
230285
@SuppressWarnings("nullness")
  private static <T> T castNonNull(@javax.annotation.Nullable T arg) {
    return arg;
  }
113516
function empty(arg0, datatype) {
    var A;
    if (Array.isArray(arg0)) {
        A = new ndarray_1.NDArray({ shape: arg0, datatype: datatype });
    }
    else {
        A = new ndarray_1.NDArray({ shape: [arg0], datatype: datatype });
    }
    return A;
}
980247
function getArgs(args) {

  if (args.length === 0) {
    return [];
  }

  if (Array.isArray(args[0])) {
    return args[0];
  }

  return Array.prototype.slice.call(args);
}
901078
@Nullable
  @ReturnsMutableCopy
  public static float [] getCopy (@Nullable final float... aArray)
  {
    return aArray == null ? null : getCopy (aArray, 0, aArray.length);
  }
221514
function getSpliceEquivalent(array, methodName, args) {
  	switch (methodName) {
  		case "splice":
  			if (args[0] !== undefined && args[0] < 0) {
  				args[0] = array.length + Math.max(args[0], -array.length);
  			}

  			while (args.length < 2) {
  				args.push(0);
  			}

  			// ensure we only remove elements that exist
  			args[1] = Math.min(args[1], array.length - args[0]);

  			return args;

  		case "sort":
  		case "reverse":
  			return null;

  		case "pop":
  			if (array.length) {
  				return [array.length - 1, 1];
  			}
  			return [0, 0];

  		case "push":
  			return [array.length, 0].concat(args);

  		case "shift":
  			return [0, array.length ? 1 : 0];

  		case "unshift":
  			return [0, 0].concat(args);
  	}
  }
369011
public static String[] sortStringArray(String[] array) {
        if (isEmpty(array)) {
            return new String[0];
        }
        Arrays.sort(array);
        return array;
    }
57294
public static <T> T getLastElement(final T[] array) {

    return isNotEmpty(array) ? array[array.length - 1] : null;
  }
508191
protected int cancel(String[] args) {
		// Parse command line options
		CommandLine line;
		try {
			line = parser.parse(CANCEL_OPTIONS, args, false);
		}
		catch (MissingOptionException e) {
			System.out.println(e.getMessage());
			printHelpForCancel();
			return 1;
		}
		catch (UnrecognizedOptionException e) {
			System.out.println(e.getMessage());
			printHelpForCancel();
			return 2;
		}
		catch (Exception e) {
			return handleError(e);
		}
		
		if (printHelp) {
			printHelpForCancel();
			return 0;
		}
		
		JobID jobId;
		
		if (line.hasOption(ID_OPTION.getOpt())) {
			String jobIdString = line.getOptionValue(ID_OPTION.getOpt());
			try {
				jobId = new JobID(StringUtils.hexStringToByte(jobIdString));
			} catch (Exception e) {
				System.out.println("Error: The value for the Job ID is not a valid ID.");
				printHelpForCancel();
				return 1;
			}
		} else {
			System.out.println("Error: Specify a Job ID to cancel a job.");
			printHelpForCancel();
			return 1;
		}
		
		ExtendedManagementProtocol jmConn = null;
		try {
			jmConn = getJobManagerConnection(line);
			if (jmConn == null) {
				printHelpForCancel();
				return 1;
			}
			
			jmConn.cancelJob(jobId);
			return 0;
		}
		catch (Throwable t) {
			return handleError(t);
		}
		finally {
			if (jmConn != null) {
				try {
					RPC.stopProxy(jmConn);
				} catch (Throwable t) {
					System.out.println("Warning: Could not cleanly shut down connection to the JobManager.");
				}
			}
			jmConn = null;
		}
	}
1033460
public static String orderBy(OrderByArg... args) {
		if (EmptyUtil.isEmpty(args) == true) {
			return "";
		}
		StringBuilder sql = new StringBuilder();
		Arrays.asList(args).forEach(arg -> {
			sql.append(arg.getColumnName());
			SortType sortType = arg.getSortType();
			if (sortType != null) {
				sql.append(" ");
				sql.append(sortType.toString());
			}
			sql.append(", ");
		});
		sql.setLength(sql.length() - ", ".length());
		return sql.toString();
	}
1105378
public static Name getFirstArgumentAsName(Object[] args) {
        Assert.notEmpty(args);

        Object firstArg = args[0];
        return getArgumentAsName(firstArg);
    }
453123
static double[] sortAndRevert(final double[] array) {
		final int[] indexes = sort(array);

		// Copy the elements in reversed order.
		final double[] result = new double[array.length];
		for (int i = 0; i < result.length; ++i) {
			result[indexes[result.length - 1 - i]] = array[indexes[i]];
		}

		return result;
	}
41518
@Override
    public List<Class<?>> scan(Object... args) {
        if (args == null || args.length == 0) {
            return Collections.emptyList();
        }
        List<Class<?>> result = null;
        for (Object obj : args) {
            List<Class<?>> list = scan((String) obj);
            if (result == null) {
                result = list;
            } else {
                result.addAll(list);
            }
        }
        return result;
    }
658360
public static Array listToArrayRemoveEmpty(String list, char delimiter) {
	int len = list.length();
	ArrayImpl array = new ArrayImpl();
	if (len == 0) return array;
	int last = 0;

	for (int i = 0; i < len; i++) {
	    if (list.charAt(i) == delimiter) {
		if (last < i) array.appendEL(list.substring(last, i));
		last = i + 1;
	    }
	}
	if (last < len) array.appendEL(list.substring(last));

	return array;
    }