Put a key/boolean pair in the JSONObject.

@param key
A key string.
@param value
A boolean which is the value.
@return this.
@throws JSONException
If the value is non-finite number.
@throws NullPointerException
If the key is <code>null</code>.
323234
public JSONObject put(String key, boolean value) throws JSONException {
        return this.put(key, value ? Boolean.TRUE : Boolean.FALSE);
    }
949427
@PublicEvolving
	public void setBoolean(ConfigOption<Boolean> key, boolean value) {
		setValueInternal(key.key(), value);
	}
836267
public V putIfAbsent( K key, V value )
  {
    if( value == null )
    {
      throw new NullPointerException();
    }
    int hash = hash( key.hashCode() );
    return segmentFor( hash ).put( key, hash, value, true );
  }
984757
private void addToJsonArray(String key, JsonValue value){
        if (value == null){
            throw new NullPointerException("Value cannot be null.");
        }
        
        PiwikJsonArray a = (PiwikJsonArray)parameters.get(key);
        if (a == null){
            a = new PiwikJsonArray();
            parameters.put(key, a);
        }
        a.add(value);
    }
905437
public @Nonnull JsonBuilder put(String key, boolean b) {
        object.put(key, primitive(b));
        return this;
    }
1344403
public JSONArray put(int index, Map<String, Object> value) throws JSONException {
        this.put(index, new JSONObject(value));
        return this;
    }
1153927
public boolean set(String path, Object value) {
        jsonStore.clear();
        return JSONPath.set(jsonObject, checkPath(path), value);
    }
1099959
public void put(String key, String value) {
        if (validCharacters(key) && validCharacters(value)) {
            this.values.put(key, value);
        }
    }
457727
public void put(Object key, Object value)
    {
        keyTable.put(key, value);
        valueTable.put(value, key);
    }
1251493
public void put(K key, V value) {
        checkNotNull(key, "Key cannot be null");
        checkNotNull(value, "Value cannot be null");

        Set<V> values = backingMap.get(key);
        if (values == null) {
            values = new HashSet<V>();
            backingMap.put(key, values);
        }
        values.add(value);
    }
1112873
public JSONObject element( String key, boolean value ) {
      verifyIsNull();
      return element( key, value ? Boolean.TRUE : Boolean.FALSE );
   }
861954
public void set(String key, String value)
    {
        if(key == null)
            throw new IllegalArgumentException("Null keys not allowed.");

        if(value == null)
            throw new IllegalArgumentException("Null values not allowed.");

        ArrayList<String> vals = new ArrayList<String>();
        vals.add(value);
        map.put(key,vals);

    }
1280144
public boolean getBoolean(String key) throws JSONException {
        Object object = this.get(key);
        if (object.equals(Boolean.FALSE)
                || (object instanceof String && ((String) object)
                        .equalsIgnoreCase("false"))) {
            return false;
        } else if (object.equals(Boolean.TRUE)
                || (object instanceof String && ((String) object)
                        .equalsIgnoreCase("true"))) {
            return true;
        }
        throw new JSONException("JSONObject[" + quote(key)
                + "] is not a Boolean.");
    }
868964
public void put(final String key, final String value) {
        if (value == null) {
            throw new IllegalArgumentException("No value provided for key " + key);
        }
        validate(key, value);
        data.putValue(key, value);
    }
1104471
public function put($value, $key = NULL)
	{
		// disallow non-integer keys
		if($key !== NULL && gettype($key) != 'integer')
		{
			throw new JSONException('Key value must be an integer value');
		}
		
		if(gettype($value) == 'object' && !($value instanceof JSONObject) && !($value instanceof JSONArray))
		{
			$value = new JSONObject($value);
		}
		elseif(gettype($value) == 'array')
		{
			$value = new JSONArray($value);
		}
		
		$this->testValidity($value);
		
		if($key != NULL && in_array($key, $this->map))
			$this->map[$key] = $value;
		else
			$this->map[] = $value;
		
		return $this;
	}
613957
@Override
	public JSONObject put(String key, Object value) throws JSONException {
		if (null == key) {
			return this;
		}

		final boolean ignoreNullValue = this.config.isIgnoreNullValue();
		if (ObjectUtil.isNull(value) && ignoreNullValue) {
			// 忽略值模式下如果值为空清除key
			this.remove(key);
		} else {
			InternalJSONUtil.testValidity(value);
			this.rawHashMap.put(key, JSONUtil.wrap(value, ignoreNullValue));
		}
		return this;
	}
555939
public void put(int key, boolean value) {
        int i = ContainerHelpers.binarySearch(mKeys, mSize, key);

        if (i >= 0) {
            mValues[i] = value;
        } else {
            i = ~i;

            if (mSize >= mKeys.length) {
                int n = ArrayUtils.idealIntArraySize(mSize + 1);

                int[] nkeys = new int[n];
                boolean[] nvalues = new boolean[n];

                // Log.e("SparseBooleanArray", "grow " + mKeys.length + " to " + n);
                System.arraycopy(mKeys, 0, nkeys, 0, mKeys.length);
                System.arraycopy(mValues, 0, nvalues, 0, mValues.length);

                mKeys = nkeys;
                mValues = nvalues;
            }

            if (mSize - i != 0) {
                // Log.e("SparseBooleanArray", "move " + (mSize - i));
                System.arraycopy(mKeys, i, mKeys, i + 1, mSize - i);
                System.arraycopy(mValues, i, mValues, i + 1, mSize - i);
            }

            mKeys[i] = key;
            mValues[i] = value;
            mSize++;
        }
    }