Replicates a string.
@param s         the string to replicate
@param times     number of times
@return combined string
424090
public static String replicate(String s, int times) {
        if (s==null) return null;
        if (times <= 0 || s.length() == 0) return "";

        StringBuilder b = new StringBuilder(s.length() * times);
        for (int k = 1; k <= times; ++k) b.append(s);
        return b.toString();
    }
12547
def generate_s
      result = sprintf("%8.8x-%4.4x-%4.4x-%2.2x%2.2x-", @time_low, @time_mid,
        @time_hi_and_version, @clock_seq_hi_and_reserved, @clock_seq_low);
      6.times do |i|
        result << sprintf("%2.2x", @nodes[i])
      end
      return result.downcase
    end
347126
private String fill(char symbol, int times) {
        char[] result = new char[times];


        for (int i = 0; i < times; i++) {
            result[i] = symbol;
        }

        return new String(result);
    }
685831
public Matrix3D times(double s) {
        Matrix3D A = this;
        Matrix3D C = new Matrix3D(A);
        for (int i = 0; i < C.M; i++)
            for (int j = 0; j < C.N; j++)
                for (int l = 0; l < C.K; l++)
                    C.data[i][j][l] *= s;
        return C;
    }
559855
public static double times(double[] nums) {
        if (nums == null || nums.length == 0)
            return 0;
        double ret = 1;
        for (int i = 0; i < nums.length; i++)
            ret *= nums[i];
        return ret;
    }
427689
function _repeat (source, times) {
    var result = "";

    for (var i = 0; i < times; i++) {
        result += source;
    }

    return result;
}
949402
function(str, times) {
        if (String.prototype.repeat) return str.repeat(times);
        return Array.apply(null, new Array(times)).map(function() {
          return str;
        }).join('');
      }
397450
public void append(String s) {
        int length = s.length();
        if (this.length + length > this.ch.length) {
            int newLength = this.ch.length*2;
            if (newLength < this.length + length + DEFAULT_SIZE)
                newLength = this.ch.length + length + DEFAULT_SIZE;
            char[] newch = new char[newLength];            
            System.arraycopy(this.ch, 0, newch, 0, this.length);
            this.ch = newch;
        }
        s.getChars(0, length, this.ch, this.length);
        this.length += length;
    }
473903
@Override
    public Map<String, String> deserialize(String s) {

        try {

            String input = multiline ? s : s.replace('&', '\n');

            Properties props = new Properties();
            if (s != null) {
                props.load(new StringReader(input));
            }

            LinkedHashMap<String, String> result = new LinkedHashMap<String, String>();
            for (Entry<Object, Object> entry : props.entrySet()) {
                result.put(entry.getKey().toString(), entry.getValue().toString());
            }
            return result;

        } catch (IOException e) {
            throw new IllegalStateException(e);
        }

    }
940548
function repeat(input, n) {

    var times = ~~n;

    return (!isString(input) || !times) ? input : strRepeat(input, n);
}
40828
public static Set<String> set(String... ss) {
        Set<String> set = new HashSet<String>();
        set.addAll(Arrays.asList(ss));
        return set;
    }
727198
public AbstractLongList times(int times) {
	AbstractLongList newList = new LongArrayList(times*size());
	for (int i=times; --i >= 0; ) {
		newList.addAllOfFromTo(this,0,size()-1);
	}
	return newList;
}
565660
public static String[] spansToStrings(Error[] spans, CharSequence s) {
    String[] tokens = new String[spans.length];

    for (int si = 0, sl = spans.length; si < sl; si++) {
      tokens[si] = spans[si].getCoveredText(s).toString();
    }

    return tokens;
  }
821267
public static Set<String> restoreSet(final String s, final String delim) {
        final Set<String> copytoSet = new HashSet<>();

        if (StringUtils.isEmptyString(s)) {
            return copytoSet;
        }

        final StringTokenizer st = new StringTokenizer(s, delim);

        while (st.hasMoreTokens()) {
            final String entry = st.nextToken();
            if (!StringUtils.isEmptyString(entry)) {
                copytoSet.add(entry);
            }
        }
        return copytoSet;
    }
1328330
public static List<String> split(String s, String separator) {
        if (s == null) return null;
        List<String> rslt = null;
        if (s.isEmpty() || isEmpty(separator)) {
            rslt = new ArrayList<>(1);
            rslt.add(s);
            return rslt;
        }

        //return s.split(COMMA_SPLIT); - NOT WORKING when compiled to JS

        int start = 0;
        int p = start;
        do {
            int j = s.indexOf(separator, p);
            if (j == -1) {
                if (rslt == null) {
                    rslt = new ArrayList<>(1);
                    rslt.add(s);
                    return rslt;
                }
                rslt.add(s.substring(start));
                break;
            }
            if (j > 0 && s.charAt(j - 1) == '\\') {
                p = j + 1;
                continue;
            } else {
                if (rslt == null) rslt = new ArrayList<String>();
                rslt.add(s.substring(start, j));
                start = j + 1;
                p = start;
            }

        } while (true);

        return rslt;
    }
1122832
public static Object repeat(Object arr, int times) {
        Class<?> toType = Types.arrayElementType(arr.getClass());
        if ( times < 1 )
            return Array.newInstance(toType, 0);
        int[] dims = dimensions(arr);
        int length = dims[0];
        dims[0] *= times;
        int i = 0, total = dims[0];
        Object toArray = Array.newInstance(toType, dims);
        while ( i < total ) {
            System.arraycopy(arr, 0, toArray, i, length);
            i += length;
        }
        return toArray;
    }
941893
def deduplicate(s, ch):
    
    return ch.join([substring for substring in s.strip().split(ch) if substring])