Insert a value in an existing array only if the value
isn't already contained in the array (by way of string comparison).

@param path the path to mutate in the JSON.
@param value the value to insert.
8232
public <T> AsyncMutateInBuilder arrayAddUnique(String path, T value) {
        this.mutationSpecs.add(new MutationSpec(Mutation.ARRAY_ADD_UNIQUE, path, value));
        return this;
    }
1007825
public PactDslJsonArray includesStr(String value) {
    body.put(value);
    matchers.addRule(rootPath + appendArrayIndex(0), includesMatcher(value));
    return this;
  }
442458
public boolean load(String path, V[] value)
    {
        byte[] bytes = IOUtil.readBytes(path);
        if (bytes == null) return false;
        _ValueArray valueArray = new _ValueArray(value);
        ByteArray byteArray = new ByteArray(bytes);
        for (int i = 0; i < child.length; ++i)
        {
            int flag = byteArray.nextInt();
            if (flag == 1)
            {
                child[i] = new Node<V>();
                child[i].walkToLoad(byteArray, valueArray);
            }
        }
        size = value.length;

        return true;
    }
398795
public void insertSorted(T value) {
    add(value);
    @SuppressWarnings("unchecked")
    Comparable<T> cmp = (Comparable<T>) value;
    for (int i = size() - 1; i > 0 && cmp.compareTo(get(i - 1)) < 0; i--) {
      Collections.swap(this, i, i - 1);
    }
  }
1043798
public <T> MutateInBuilder upsert(String path, T fragment) {
        asyncBuilder.upsert(path, fragment);
        return this;
    }
423404
public boolean createNode(String path, String value) throws ZooKeeperException {
        return _create(path, value != null ? value.getBytes(UTF8) : null, CreateMode.PERSISTENT);
    }
1099959
public void put(String key, String value) {
        if (validCharacters(key) && validCharacters(value)) {
            this.values.put(key, value);
        }
    }
1139949
public static function insert(&$arr, $path, $value, $delimiter = '.')
    {
        if (! static::exists($arr, $path, $delimiter)) {
            static::set($arr, $path, $value, $delimiter);
        }
    }
601642
public boolean load(String path, List<V> value)
    {
        if (!loadBaseAndCheck(path)) return false;
        v = (V[]) value.toArray();
        return true;
    }
1294998
public void add(long value) {
		int index = Arrays.binarySearch(bins, value);
		if (index < 0) {
			// inexact match, take the first bin higher than value
			index = -index - 1;
		}
		hits.incrementAndGet(index);
	}
1320158
public void insert(Path filePath, String chromosome, List<Integer> values) {

        Connection conn = null;

        try {
            Class.forName("org.sqlite.JDBC");
            conn = DriverManager.getConnection("jdbc:sqlite:" + databasePath);

            // get the file ID from the database, (if it does not exits, the file will be inserted)
            int fileId = getFileId(filePath, conn);
            if (fileId == -1) {
                throw new InternalError("Impossible to insert file '" + filePath
                        + "' into the database '" + databasePath + "'");
            }

            // update chromosome chunks, inserting them to the database and update the map, if necessary
            if (!chunkIdMap.containsKey(buildChunkMapKey(chromosome, 1))) {
                updateChromosomeChunks(chromosome, values.size(), conn);
            }

            // reset counters
            resetCounters();
            int chunk64k = 0;

            // prepare statement to iterate over the values
            PreparedStatement insertCoverage = conn.prepareStatement("insert into mean_coverage (chunk_id, "
                    + " file_id, v1, v2, v3, v4, v5, v6, v7, v8) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
            conn.setAutoCommit(false);

            // main loop
            for (int v: values) {
                chunkValues[counter1] = (byte) Math.min(v, 255);
                if (++counter1 == 8) {
                    // packed mean coverages and save into the packed coverages array
                    packedChunkValues[counter2] = bytesToLong(chunkValues);
                    if (++counter2 == 8) {
                        // write packed coverages array to DB
                        insertPackedChunkValues(insertCoverage, getChunkId(chromosome, chunk64k),
                                fileId, packedChunkValues);

                        // update counters and reset packed coverages array and counter2
                        chunk64k++;
                        Arrays.fill(packedChunkValues, 0);
                        counter2 = 0;
                    }
                    // reset mean coverages array and counter1
                    counter1 = 0;
                    Arrays.fill(chunkValues, (byte) 0);
                }
            }

            // write to DB, if pending mean values
            if (counter1 > 0 || counter2 > 0) {
                packedChunkValues[counter2] = bytesToLong(chunkValues);
                insertPackedChunkValues(insertCoverage, getChunkId(chromosome, chunk64k), fileId, packedChunkValues);
            }
            // execute batch
            insertCoverage.executeBatch();
            conn.commit();
            conn.setAutoCommit(true);

            // close resources
            conn.close();
        } catch (SQLException e) {
            logger.error(e.getClass().getName() + ": " + e.getMessage());
            cleanConnectionClose(conn, null);
        } catch (ClassNotFoundException e) {
            logger.error(e.getClass().getName() + ": " + e.getMessage());
            e.printStackTrace();
        }
    }
349808
public void setPath(String path)
    {
        if (getState() != __MSG_EDITABLE) throw new IllegalStateException("Not EDITABLE");
        if (_uri == null)
            _uri = new URI(path);
        else
            _uri.setURI(path);
    }
882566
public static function set(array &$array, string $path, $value)
    {
        // Get segments from path
        $segments = explode('.', $path);

        // Loop through segments
        while (count($segments) > 1) {
            $segment = array_shift($segments);
            if (!isset($array[$segment]) || !is_array($array[$segment])) {
                $array[$segment] = [];
            }
            $array =& $array[$segment];
        }
        $array[array_shift($segments)] = $value;
    }
818148
public final void addValue(@NonNull final String value) {
        Condition.INSTANCE.ensureNotNull(value, "The value may not be null");

        if (this.values != null) {
            if (this.values.add(value)) {
                if (persistSet(this.values)) {
                    notifyChanged();
                }
            }
        } else {
            Set<String> newValues = new HashSet<>();
            newValues.add(value);
            setValues(newValues);
        }
    }
1113591
public void add(T value) {
        if (value == null)
            return;

        if (map.containsKey(value)) {
            map.put(value, map.get(value) + 1);
        } else {
            map.put(value, 1l);
        }
    }
948878
public static function insert(array $set, $path, $value) {
        if (!$path) {
            return $set;
        }

        // Exit early for faster processing
        if (strpos($path, '.') === false) {
            $set[$path] = $value;

            return $set;
        }

        $search =& $set;
        $paths = explode('.', $path);
        $total = count($paths);

        while ($total > 0) {
            $key = $paths[0];

            // Within the last path
            if ($total === 1) {
                $search[$key] = $value;

            // Break out of non-existent paths early
            } else if (!array_key_exists($key, $search) || !is_array($search[$key])) {
                $search[$key] = array();
            }

            $search =& $search[$key];
            array_shift($paths);
            $total--;
        }

        unset($search);

        return $set;
    }
1229692
public void put(String key, byte[] value) {
		if (this.compiledStatement != null) {
			if (value == null) {
				this.compiledStatement.bindNull(compiledStatementBindIndex++);
			} else {
				compiledStatement.bindBlob(compiledStatementBindIndex++, value);
			}
		} else if (values != null) {
			values.put(key, value);
			return;
		}

		names.add(key);
		// values.put(key, value);
		args.add(value);
		valueType.add(ParamType.BYTE_ARRAY);
	}