Prepend to an existing array, pushing the value to the front/first position in
the array.

@param path the path of the array.
@param value the value to insert at the front of the array.
354527
public <T> MutateInBuilder arrayPrepend(String path, T value) {
        asyncBuilder.arrayPrepend(path, value);
        return this;
    }
509943
public synchronized void prepend(String k, String v) {
        grow();
        for (int i = nkeys; i > 0; i--) {
            keys[i] = keys[i-1];
            values[i] = values[i-1];
        }
        keys[0] = k;
        values[0] = v;
        nkeys++;
    }
1099420
public CmsPathValue prepend(String pathPart) {

        return new CmsPathValue(m_value, CmsStringUtil.joinPaths(pathPart, m_path));
    }
77767
public function set(string $path, $value): void
    {
        if (!empty($path)) {
            $at = & $this->items;
            $keys = $this->explode($path);

            while (count($keys) > 0) {
                if (count($keys) === 1) {
                    if (!is_array($at)) {
                        throw new RuntimeException('Can not set value at this path ['.$path.'] because is not array.');
                    }
                    $at[array_shift($keys)] = $value;
                } else {
                    $key = array_shift($keys);
                    if (!isset($at[$key])) {
                        $at[$key] = [];
                    }
                    $at =& $at[$key];
                }
            }
        } else {
            $this->items = [$value];
        }
    }
176147
public static function set(array &$values, $path, $value)
    {
        if (is_array($path)) {
            // The path has already been separated into segments
            $segments = $path;
        } else {
            $path = (string) $path;

            // Remove starting delimiters and spaces
            $path = ltrim($path, sprintf('%s ', static::PATH_DELIMITER));
            // Remove ending delimiters, spaces, and wildcards
            $path = rtrim($path, sprintf('%s %s', static::PATH_DELIMITER, static::PATH_WILDCARD));
            // Split the segments by delimiter
            $segments = explode(static::PATH_DELIMITER, $path);
        }

        while (count($segments) > 1) {
            $key = array_shift($segments);

            /** @noinspection ReferenceMismatchInspection */
            if (!array_key_exists($key, $values) || !is_array($values[$key])) {
                $values[$key] = [];
            }

            $values =& $values[$key];
        }

        $values[array_shift($segments)] = $value;
    }
51032
public static function append(&$arr, $str_path, $value) {
		$path = explode('.', $str_path);
		static::array_append($arr, $path, $value);
	}
1214624
public static function set(array $set, $path, $value = null) {
        if (is_array($path)) {
            foreach ($path as $key => $value) {
                $set = static::insert($set, $key, $value);
            }
        } else {
            $set = static::insert($set, $path, $value);
        }

        return $set;
    }
1187853
public void add(final String path) {
        final Set<String> paths = new LinkedHashSet<String>();
        paths.addAll(get());
        paths.add(path);
        set(paths);
    }
1298087
public function setPropertyByPath($path, $value)
    {
        $this->properties = Arrays::setValueByPath($this->properties, $path, $value);
    }
277818
public void append(K key, V value) {
        int index = mSize;
        final int hash = key == null ? 0 : key.hashCode();
        if (index >= mHashes.length) {
            throw new IllegalStateException("Array is full");
        }
        if (index > 0 && mHashes[index-1] > hash) {
            RuntimeException e = new RuntimeException("here");
            e.fillInStackTrace();
            Log.w(TAG, "New hash " + hash
                    + " is before end of array hash " + mHashes[index-1]
                    + " at index " + index + " key " + key, e);
            put(key, value);
            return;
        }
        mSize = index+1;
        mHashes[index] = hash;
        index <<= 1;
        mArray[index] = key;
        mArray[index+1] = value;
    }
881620
function setValueForPath(object, path, value, index) {
		index = index || 0;

		if (path.length > index + 1) {
			var obj = object[path[index]];

			// we always want the last object in an array
			if (_.isArray(obj)) obj = _.last(obj);

			setValueForPath(obj, path, value, index + 1);
		} else {
			// found the object so set its value
			object[path[index]] = value;
		}
	}
277820
public void prepend(StringBuilder buffer, Object value) {
        if (buffer == null) {
            throw new NullPointerException("buffer");
        }

        buffer.insert(0, value);
    }
93502
public void addPath(String path) {
        if (path == null) {
            return;
        }
        String[] pathComponents = path.split("/");
        TrieNode parent = rootNode;
        String part = null;
        if (pathComponents.length <= 1) {
            throw new IllegalArgumentException("Invalid path " + path);
        }
        for (int i=1; i<pathComponents.length; i++) {
            part = pathComponents[i];
            if (parent.getChild(part) == null) {
                parent.addChild(part, new TrieNode(parent));
            }
            parent = parent.getChild(part);
        }
        parent.setProperty(true);
    }
1176325
public function prepend($key, $value)
    {
        $array = $this->get($key);

        array_unshift($array, $value);

        $this->set($key, $array);
    }
191331
public void addPath(T value, byte[]... parts)
    {
        int depth = 0;
        ByteTrieNode<T> node = _root;
        for (byte[] part : parts) {
            for (byte b : part) {
                ByteTrieNode<T> child = node._children.get(b);
                if (child == null) {
                    child = new ByteTrieNode<T>();
                    node._children.put(b, child);
                }
                node = child;
                depth++;
            }
        }
        if (depth == 0)
            throw new IllegalArgumentException("Parts must contain at least one byte.");
        node.setValue(value);
        _maxDepth = Math.max(_maxDepth, depth);
    }
13121
static protected function insertValueIntoStructureByPath(array $path, &$target, $value) {
		$segment = array_shift($path);
		if (count($path) > 0) {
			if (!array_key_exists($segment, $target)) {
				$target[$segment] = array();
			}
			self::insertValueIntoStructureByPath($path, $target[$segment], $value);
		} else {
			$target[$segment] = $value;
		}
		ksort($target);
	}
966095
public static function setByPath(&$data, string $path, $value, string $separator = '.'): void
    {
        if (false === \strpos($path, $separator)) {
            $data[$path] = $value;
            return;
        }

        if (!$nodes = \array_filter(\explode($separator, $path))) {
            return;
        }

        $dataTmp = &$data;

        foreach ($nodes as $node) {
            if (\is_array($dataTmp)) {
                if (empty($dataTmp[$node])) {
                    $dataTmp[$node] = [];
                }

                $dataTmp = &$dataTmp[$node];
            } else {
                // If a node is value but path is not go to the end, we replace this value as a new store.
                // Then next node can insert new value to this store.
                $dataTmp = [];
            }
        }

        // Now, path go to the end, means we get latest node, set value to this node.
        $dataTmp = $value;
    }