Helper to clean out some characters
@param values The collection of strings to cleanup
@return An empty string if values was empty or a cleaned up string
337631
private String clean(final Collection<String> values) {
    if (values == null || values.size() == 0) {
      return "";
    }

    final List<String> strs = Lists.newArrayList();
    for (String v : values) {
      final String tmp = v.replaceAll("\\{.*\\}", "");
      final int ix = tmp.lastIndexOf(':');
      if (ix < 0) {
        strs.add(tmp);
      } else {
        strs.add(tmp.substring(ix+1));
      }
    }

    return DOUBLE_COMMA_JOINER.join(strs);
  }
602210
function clean(values) {
  var index = -1;
  var length = values.length;
  var result = [];
  var prev = null;
  var value;

  while (++index < length) {
    value = values[index];

    if (prev && 'value' in value && value.type === prev.type) {
      prev.value += value.value;
    } else {
      result.push(value);
      prev = value;
    }
  }

  return result;
}
97250
public final RiakIndex<T> remove(Collection<T> values)
    {
        for (T value : values)
        {
            remove(value);
        }
        return this;
    }
1224535
def cleanup_strings(strings, strip: true)
      strings = Array(strings).flatten.map! { |s| cleanup_string(s, strip: strip) }
      strings.reject!(&:blank?)
      strings
    end
155803
public function trim($values = " \t\n\r\0\x0B"): Utility
    {
        $parameters = $this->parameters($values);

        $string = trim($this->string, implode('', $parameters));

        return new static($string, $this->encoding);
    }
1065426
@Deprecated
    public static List<String> trim(List<String> values) {
        List<String> trimmed = new ArrayList<>();
        for (String value : values) {
            trimmed.add(value.trim());
        }
        return trimmed;
    }
329973
public static String stripNonLongChars(final String value) {
        final StringBuilder newString = new StringBuilder();

        for (int i = 0; i < value.length(); i++) {
            final char c = value.charAt(i);
            if (c == '.') {
                // stop if we hit a decimal point
                break;
            } else if (c >= '0' && c <= '9' || c == '-') {
                newString.append(c);
            }
        }
        // check to make sure we do not have a single length string with
        // just a minus sign
        final int sLen = newString.length();
        final String s = newString.toString();
        if (sLen == 0 || sLen == 1 && "-".equals(s)) {
            return "0";
        }

        return newString.toString();
    }
1031621
@Override
    public String stripQuotes(String value) {
        if (null == value) {
            return null;
        }
        String modvalue = value.trim();
        if (0 == modvalue.length()) {
            return modvalue;
        }
        boolean needTrimming = false;
        int start = 0;
        if ('"' == modvalue.charAt(0) || '\'' == modvalue.charAt(0)) {
            start = 1;
            needTrimming = true;
        }
        int end = modvalue.length() - 1;
        if ('"' == modvalue.charAt(end) || '\'' == modvalue.charAt(end)) {
            needTrimming = true;
        } else {
            end++;
        }
        if (needTrimming) {
            return modvalue.substring(start, end);
        }
        return modvalue;
    }
1066478
public static String implode(int[] values, String separator) {
        StringBuffer result = new StringBuffer();
        for (int i = 0; i < values.length; i++) {
            if (i > 0)
                result.append(separator);
            result.append(values[i]);
        }
        return result.toString();
    }
1259228
protected Map<CharSequence, List<V>> wrapValues(Map<CharSequence, List<V>> values) {
        return Collections.unmodifiableMap(values);
    }
206902
public static String valueString(final Object value) {
        StringBuilder val = new StringBuilder(""+value);
        if (null != value && value.getClass().isArray()) {
            val = new StringBuilder("{");
            for (int i = 0; i < Array.getLength(value); i++)
                val.append(valueString(Array.get(value, i))).append(", ");
            if (val.reverse().charAt(0) == ' ')
                val.delete(0, 2);
            return val.reverse().append("}").toString();
        }
        if (value instanceof Collection) {
            val = new StringBuilder("[");
            for (Object v : ((Collection<?>) value))
                val.append(valueString(v)).append(", ");
            if (val.reverse().charAt(0) == ' ')
                val.delete(0, 2);
            return val.reverse().append("]").toString();
        }
        if (value instanceof Map) {
            val = new StringBuilder("{");
            for (Entry<?, ?> e : ((Map<?, ?>) value).entrySet())
                val.append(valueString(e.getKey())).append("=")
                .append(valueString(e.getValue())).append(", ");
            if (val.reverse().charAt(0) == ' ')
                val.delete(0, 2);
            return val.reverse().append("}").toString();
        }
        if (value instanceof Entry) {
            return new StringBuilder(
                    valueString(((Entry<?, ?>) value).getKey()))
                .append("=").append(
                    valueString(((Entry<?, ?>) value).getValue()))
                .toString();
        }
        if (value instanceof String)
            return val.insert(0, "\"").append("\"").toString();
        if (Primitive.unwrap(value) instanceof Character)
            return val.insert(0, "'").append("'").toString();
        if (Primitive.unwrap(value) instanceof Number) {
            if (Primitive.unwrap(value) instanceof Byte)
                return val.append("o").toString();
            if (Primitive.unwrap(value) instanceof Short)
                return val.append("s").toString();
            if (Primitive.unwrap(value) instanceof Integer)
                return val.append("I").toString();
            if (Primitive.unwrap(value) instanceof Long)
                return val.append("L").toString();
            if (Primitive.unwrap(value) instanceof BigInteger)
                return val.append("W").toString();
            if (Primitive.unwrap(value) instanceof Float)
                return val.append("f").toString();
            if (Primitive.unwrap(value) instanceof Double)
                return val.append("d").toString();
            if (Primitive.unwrap(value) instanceof BigDecimal)
                return val.append("w").toString();
        }
        return val.toString();
    }

    /** Count region matches.
     * @param one string to compare
     * @param two string to compare with
     * @return return max common string */
    public static String maxCommonPrefix(String one, String two) {
        int i=0;
        while( one.regionMatches(0, two, 0, i ))
            i++;
        return one.substring(0, i-1);
    }

    /** Produce a method string from supplied value args.
     * @param name method name.
     * @param args the value to process.
     * @return still just a method string. */
    public static String methodString(String name, Object[] args) {
        return methodString(name, Types.getTypes(args));
    }

    /** Produce a simple string representation of a method name with args.
     * @param name the method name
     * @param types the parameter type names
     * @return string representation of a method */
    public static String methodString(String name, String[] types) {
        StringBuilder sb = new StringBuilder();
        sb.append(name).append('(');
        for( int i=0; i<types.length; i++ ) {
            if (i != 0)
                sb.append(", ");
            sb.append(types[i]);
        }
        sb.append(')');
        return sb.toString();
    }

    /** Produce a simple string representation of a method name with args.
     * @param name the method name
     * @param types the parameter type args
     * @return string representation of a method */
    public static String methodString(String name, Class<?>[] types) {
        return methodString(name, getTypeNames(types));
    }

    /** Produce a simple string representation of a method name with args.
     * @param name the method name
     * @param types the parameter type args
     * @param names the parameter names
     * @return string representation of a method */
    public static String methodString(String name, Class<?>[] types, String[] names) {
        return methodString(name, getTypeNames(types, names));
    }

    /** Get type names as stream.
     * @param types class[] of classes
     * @return Stream of type names */
    private static Stream<String> getTypeNamesStream(Class<?>[] types) {
        return Stream.of(types).map(StringUtil::getTypeName);
    }

    /** Get type names as string list.
     * @param types class[] of classes
     * @return List of type names */
    private static List<String> getTypeNamesList(Class<?>[] types) {
        return getTypeNamesStream(types).collect(Collectors.toList());
    }

    /** Get type names as string[].
     * @param types class[] of classes
     * @return String[] of type names */
    private static String[] getTypeNames(Class<?>[] types) {
        return getTypeNamesStream(types).toArray(String[]::new);
    }

    /** Get type names as string[].
     * @param types class[] of parameter classes
     * @param names string[] of parameter names
     * @return String[] of type names */
    private static String[] getTypeNames(Class<?>[] types, String[] names) {
        Iterator<String> namesIt = Stream.of(names).iterator();
        return getTypeNamesStream(types)
                .map(type -> type +" "+ namesIt.next())
                .toArray(String[]::new);
    }

    /** Get type name as string.
     * @param type class
     * @return simple name or Object if null */
    private static String getTypeName(Class<?> type) {
        return ( null == type ) ? "Object"
                : type.getSimpleName();
    }

    /** Get extends string for class.
     * @param type the class to interrogate.
     * @return if type isInterface return empty string
     *         else return extends superClass */
    private static String getTypeExtends(Class<?> type) {
        return type.isInterface() ? "" : " extends " + getTypeName(type.getSuperclass());
    }

    /** Get the implements/extends string for type.
     * @param type the class to interrogate.
     * @return string implements (for classes)/extends (for interfaces)
     *         and comma separated list of interfaces. */
    private static String getTypeImplements(Class<?> type) {
        StringBuilder sb = new StringBuilder();
        if ( type.getInterfaces().length > 0 )
            sb.append(type.isInterface() ? " extends " : " implements ")
             .append(String.join(", ", getTypeNamesList(type.getInterfaces())));
        return sb.toString();
    }

    /** Produce a complete string representation of a reflect method. Shows
     * modifiers, return type, name and parameter types.
     * @param method a java reflect method
     * @return string representation of a method */
    public static String methodString(Method method) {
        String mods = Modifier.toString(method.getModifiers());
        StringBuilder sb = new StringBuilder();
        return sb.append(mods).append(" ")
            .append(getTypeName(method.getReturnType())).append(" ")
            .append(methodString(method.getName(), method.getParameterTypes()))
            .append(mods.contains("abstract") ? ";" : " {}").toString();
    }

    /** Produce a complete string representation of a bsh method. Shows
     * modifiers, return type, name and parameter types.
     * @param method a bsh method
     * @return string representation of a method */
    public static String methodString(BshMethod method) {
        String mods = method.getModifiers().toString().substring(11);
        StringBuilder sb = new StringBuilder();
        return sb.append(mods).append(" ")
            .append(getTypeName(method.getReturnType())).append(" ")
            .append(methodString(method.getName(),
                    method.getParameterTypes(), method.getParameterNames()))
            .append(mods.contains("abstract") ? ";" : " {}").toString();
    }

    /** Produce a string representation of a bsh generated class declaration.
     * Shows modifiers, name, extends and implements.
     * @param type the class to reflect
     * @return string representation of a class declaration */
    private static String generatedClassString(Class<?> type) {
        StringBuilder sb = new StringBuilder();
        sb.append(Reflect.getClassModifiers(type).toString().substring(11))
          .append(type.isInterface() ? " interface" : " class")
          .append(" ").append(getTypeName(type))
          .append(getTypeExtends(type))
          .append(getTypeImplements(type));
        return sb.append(" {").toString().trim();
    }

    /** Produce a string representation of a class declaration.
     * Verifies if type is a generated class else builds a java
     * reflect class string definition.
     * Shows modifiers, name, extends and implements.
     * @param type the class to reflect
     * @return string representation of a class declaration */
    public static String classString(Class<?> type) {
        if (Reflect.isGeneratedClass(type))
            return generatedClassString(type);
        StringBuilder sb = new StringBuilder();
        sb.append(Modifier.toString(type.getModifiers()))
            .append(type.isInterface() ? "": " class")
            .append(" ").append(getTypeName(type))
            .append(getTypeExtends(type))
            .append(getTypeImplements(type));
        return sb.append(" {").toString().trim();
    }

    /** Produce a string representation of a bsh variable declaration.
     * Shows modifiers, type and name.
     * @param var the variable to reflect
     * @return string representation of variable declaration */
    public static String variableString(Variable var) {
        StringBuilder sb = new StringBuilder();
        sb.append(var.getModifiers().toString().substring(11))
            .append(" ").append(getTypeName(var.getType()))
            .append(" ").append(var.getName());
        return sb.append(";").toString();
    }

    /** Produce a string representation of a java field declaration.
     * Shows modifiers, type and name.
     * @param var the field to reflect
     * @return string representation of field declaration */
    public static String variableString(Field field) {
        StringBuilder sb = new StringBuilder();
        sb.append(Modifier.toString(field.getModifiers()))
            .append(" ").append(getTypeName(field.getType()))
            .append(" ").append(field.getName());
        return sb.append(";").toString();
    }
}
235358
public DeleteAction delete(String... values) {
        return new DeleteAction(this, new LiteralOperand(
                new LinkedHashSet<String>(Arrays.asList(values))));
    }
293596
public static List<String> filterEmptyValues( List<String> values ) {

		List<String> result = new ArrayList<> ();
		for( String s : values ) {
			if( ! Utils.isEmptyOrWhitespaces( s ))
				result.add( s );
		}

		return result;
	}
316314
private static String blankToNull(String value) {
		if (value != null) {
			value = value.trim();
			if (value.equals("")) {
				value = null;
			}
		}
		return value;
	}
1159182
public static int[] unWrap(Integer... values) {
		if (null == values) {
			return null;
		}
		final int length = values.length;
		if (0 == length) {
			return new int[0];
		}

		final int[] array = new int[length];
		for (int i = 0; i < length; i++) {
			array[i] = values[i].intValue();
		}
		return array;
	}
278596
public String clean(String value) {
    String orig = value;
    
    // check if there's a + before the first digit
    boolean initialplus = findPlus(value);
    
    // remove everything but digits
    value = sub.clean(value);
    if (value == null)
      return null;

    // check for initial '00'
    boolean zerozero = !initialplus && value.startsWith("00");
    if (zerozero)
      value = value.substring(2); // strip off the zeros

    // look for country code
    CountryCode ccode = findCountryCode(value);
    if (ccode == null) {
      // no country code, let's do what little we can
      if (initialplus || zerozero)
        return orig; // this number is messed up. dare not touch
      return value;

    } else {
      value = value.substring(ccode.getPrefix().length()); // strip off ccode
      if (ccode.getStripZero() && value.startsWith("0"))
        value = value.substring(1); // strip the zero

      if (ccode.isRightFormat(value))
        return "+" + ccode.getPrefix() + " " + value;
      else
        return orig; // don't dare touch this
    }
  }
682551
static protected void removeValues(TreeMultimap<Long, Long> mm, Set<Long> values) {
        Iterator<Map.Entry<Long, Long>> itr = mm.entries().iterator();
        while (itr.hasNext()) {
            Map.Entry<Long, Long> e = itr.next();
            if (values.contains(e.getValue())) {
                itr.remove();
            }
        }
    }