Map the bucket values to a new array of a different type.
424114
public static <T> T[] map(Class<T> c, Function<Long, T> f) {
    @SuppressWarnings("unchecked")
    T[] values = (T[]) Array.newInstance(c, BUCKET_VALUES.length);
    for (int i = 0; i < BUCKET_VALUES.length; ++i) {
      values[i] = f.apply(BUCKET_VALUES[i]);
    }
    return values;
  }
1034909
public void addValues(Collection<Long> values) {
		synchronized (buckets) {
			for (Long value : values) {
				addValue(value);
			}
		}
	}
724206
function(value, times) {
        if (Array.fill) {
          return new Array(times).fill(value);
        }
        return Array.apply(null, Array(+times)).map(function() {
          return value;
        });
      }
871397
public static long[] asArray() {
    long[] values = new long[BUCKET_VALUES.length];
    System.arraycopy(BUCKET_VALUES, 0, values, 0, BUCKET_VALUES.length);
    return values;
  }
651153
def convert_items(self, items):
        """"""
        return ((key, self.convert(value, self)) for key, value in items)
1122520
def extend_values(dictionary, key, items):
    """"""
    values = dictionary.get(key, [])
    try:
        values.extend(items)
    except TypeError:
        raise TypeError('Expected a list, got: %r' % items)
    dictionary[key] = values
1362322
def get_bucket(self, hash_name, bucket_key):
        
        if hash_name in self.buckets:
            if bucket_key in self.buckets[hash_name]:
                return self.buckets[hash_name][bucket_key]
        return []
128954
def _maybe_to_categorical(array):
    
    if isinstance(array, (ABCSeries, ABCCategoricalIndex)):
        return array._values
    elif isinstance(array, np.ndarray):
        return Categorical(array)
    return array
557420
def _merge_maps(m1, m2):
    """"""
    return type(m1)(chain(m1.items(), m2.items()))
1248071
def _zip(self) -> ArrayValue:
        """"""
        res = list(self.before)
        res.reverse()
        res.append(self.value)
        res.extend(list(self.after))
        return ArrayValue(res, self.timestamp)
490082
function parametersToArray(parameters) {
    return zipWith(
        (name, { type, description }) => ({
            name,
            type: getTypeName(type),
            description }),
        keys(parameters),
        values(parameters));
}
1276496
function flattenArray(array, filter, map, result) {
  let index = -1;
  while (++index < array.length) {
    const value = array[index];
    if (Array.isArray(value)) {
      flattenArray(value, filter, map, result);
    } else if (filter(value)) {
      result.push(map(value));
    }
  }
  return result;
}
949325
private void readObject (ObjectInputStream s)
         throws IOException, ClassNotFoundException
    {
        // read in number of buckets and allocate the bucket array
        _buckets = createBuckets(s.readInt());
        _loadFactor = s.readFloat();

        // read in size (number of mappings)
        int size = s.readInt();

        // read the keys and values
        for (int i=0; i<size; i++) {
            int key = s.readInt();
            @SuppressWarnings("unchecked") V value = (V)s.readObject();
            put(key, value);
        }
    }
1299035
def get_bucket(self, hash_name, bucket_key):
        
        results = []
        for row in self._get_bucket_rows(hash_name, bucket_key):
            val_dict = pickle.loads(row)
            # Depending on type (sparse or not) reconstruct vector
            if 'sparse' in val_dict:

                # Fill these for COO creation
                row = []
                col = []
                data = []

                # For each non-zero element, append values
                for e in val_dict['nonzeros']:
                    row.append(e[0])  # Row index
                    data.append(e[1])  # Value
                    col.append(0)  # Column index (always 0)

                # Create numpy arrays for COO creation
                coo_row = numpy.array(row, dtype=numpy.int32)
                coo_col = numpy.array(col, dtype=numpy.int32)
                coo_data = numpy.array(data)

                # Create COO sparse vector
                vector = scipy.sparse.coo_matrix((coo_data, (coo_row, coo_col)), shape=(val_dict['dim'], 1))

            else:
                vector = numpy.fromstring(val_dict['vector'],
                                          dtype=val_dict['dtype'])

            # Add data to result tuple, if present
            results.append((vector, val_dict.get('data')))

        return results
747844
function setToArray(set) {
  var array = new Array();
  set.forEach(function(value) {
    array.push(value);
  }, null);
  return array;
}
1031780
function _map(data, schema, options) {
    options = options || {};
    if (!schema || data === null) {
        return data;
    }
    if (schema instanceof Array) {
        return _mapArray(data, schema, options);
    }
    if (typeof schema === 'object') {
        return _mapObject(data, schema, options);
    }
    return schema;
}
1096164
def merge(*maps):
    """"""
    copies = map(deepcopy, maps)
    return reduce(lambda acc, val: acc.update(val) or acc, copies)