Return a new config dictionary with initial "hidden" keys and values from
o,
then add all keys and values from n to the new config dictionary and
return.
If returning dictionary is empty, return null instead.

@param o
@param n
@return Dictionary
967997
private static Dictionary<String, Object> massageNewConfig(Dictionary<String, Object> oldProps, Dictionary<String, Object> newProps) {
        ConfigurationDictionary ret = new ConfigurationDictionary();

        if (oldProps != null) {
            for (Enumeration<String> keyItr = oldProps.keys(); keyItr.hasMoreElements();) {
                String key = keyItr.nextElement();
                if (((key.startsWith(XMLConfigConstants.CFG_CONFIG_PREFIX) && !(key.equals(XMLConfigConstants.CFG_PARENT_PID)))
                     || key.startsWith(XMLConfigConstants.CFG_SERVICE_PREFIX))) {
                    ret.put(key, oldProps.get(key));
                }

            }
        }

        if (newProps != null) {
            for (Enumeration<String> keyItr = newProps.keys(); keyItr.hasMoreElements();) {
                String key = keyItr.nextElement();
                ret.put(key, newProps.get(key));
            }
        }

        if (ret.isEmpty()) {
            ret = null;
        } else {
            // must add config.source, else things may not process properly
            ret.put(XMLConfigConstants.CFG_CONFIG_SOURCE, XMLConfigConstants.CFG_CONFIG_SOURCE_FILE);
        }
        return ret;
    }
328194
public static byte[] serializeDoc(Node n) throws IOException {
        XmlDomWriter xw = new XmlDomWriter();
        ByteArrayOutputStream fout = new ByteArrayOutputStream();
        xw.setOutput(fout, null);
        xw.setCanonical(false);
        xw.write(n);
        fout.close();
        return fout.toByteArray();
    }
1274622
def key_dict( from_dict ):
	
	new_dict = {}
	old2new = {}
	new2old = {}
	for key in from_dict:
		k = normalizeUnicode(key,'identifier')
		if k != key:
			i = ''
			while new_dict.has_key("%s%s" % (k,i) ):
				if not i:
					i = 1
				else:
					i += 1
			k = "%s%s" % (k,i)
			old2new[key] = k
			new2old[k] = key
		new_dict[k] = from_dict[key]
	return (new_dict.keys(), new_dict, old2new, new2old)
1250969
public @Nonnull JsonBuilder put(String key, Number n) {
        object.put(key, primitive(n));
        return this;
    }
1084662
def n_dict(self, node):
        
        p = self.prec
        self.prec = 100

        self.indent_more(INDENT_PER_LEVEL)
        line_seperator = ',\n' + self.indent
        sep = INDENT_PER_LEVEL[:-1]
        start = len(self.f.getvalue())
        self.write('{')
        self.set_pos_info(node[0], start, start+1)

        if self.version >= 3.0 and not self.is_pypy:
            if node[0].kind.startswith('kvlist'):
                # Python 3.5+ style key/value list in dict
                kv_node = node[0]
                l = list(kv_node)
                length = len(l)
                if kv_node[-1].kind.startswith("BUILD_MAP"):
                    length -= 1
                i = 0
                while i < length:
                    self.write(sep)
                    name = self.traverse(l[i], indent='')
                    l[i].parent = kv_node
                    l[i+1].parent = kv_node
                    self.write(name, ': ')
                    value = self.traverse(l[i+1], indent=self.indent+(len(name)+2)*' ')
                    self.write(sep, name, ': ', value)
                    sep = line_seperator
                    i += 2
                    pass
                pass
            elif node[1].kind.startswith('kvlist'):
                # Python 3.0..3.4 style key/value list in dict
                kv_node = node[1]
                l = list(kv_node)
                if len(l) > 0 and l[0].kind == 'kv3':
                    # Python 3.2 does this
                    kv_node = node[1][0]
                    l = list(kv_node)
                i = 0
                while i < len(l):
                    l[i].parent = kv_node
                    l[i+1].parent = kv_node
                    key_start = len(self.f.getvalue()) + len(sep)
                    name = self.traverse(l[i+1], indent='')
                    key_finish = key_start + len(name)
                    val_start = key_finish + 2
                    value = self.traverse(l[i], indent=self.indent+(len(name)+2)*' ')
                    self.write(sep, name, ': ', value)
                    self.set_pos_info_recurse(l[i+1], key_start, key_finish)
                    self.set_pos_info_recurse(l[i], val_start, val_start + len(value))
                    sep = line_seperator
                    i += 3
                    pass
                pass
            pass
        else:
            # Python 2 style kvlist
            assert node[-1].kind.startswith('kvlist')
            kv_node = node[-1] # goto kvlist

            for kv in kv_node:
                assert kv in ('kv', 'kv2', 'kv3')
                # kv ::= DUP_TOP expr ROT_TWO expr STORE_SUBSCR
                # kv2 ::= DUP_TOP expr expr ROT_THREE STORE_SUBSCR
                # kv3 ::= expr expr STORE_MAP
                if kv == 'kv':
                    name = self.traverse(kv[-2], indent='')
                    kv[1].parent = kv_node
                    value = self.traverse(kv[1], indent=self.indent+(len(name)+2)*' ')
                elif kv == 'kv2':
                    name = self.traverse(kv[1], indent='')
                    kv[-3].parent = kv_node
                    value = self.traverse(kv[-3], indent=self.indent+(len(name)+2)*' ')
                elif kv == 'kv3':
                    name = self.traverse(kv[-2], indent='')
                    kv[0].parent = kv_node
                    value = self.traverse(kv[0], indent=self.indent+(len(name)+2)*' ')
                self.write(sep, name, ': ', value)
                sep = line_seperator
        self.write('}')
        finish = len(self.f.getvalue())
        self.set_pos_info(node, start, finish)
        self.indent_less(INDENT_PER_LEVEL)
        self.prec = p
        self.prune()
1033004
private void setValueFromObject(org.w3c.dom.Node n) {
        DOMProcessing.trimNode(n);
        try {
            setValue(DOMProcessing.writeToString(n));
        } catch (TransformerConfigurationException e) {
            setValue(n.toString());  // TODO: not the most compelling handling
        } catch (TransformerException e) {
            setValue(n.toString()); //TODO: not the most compelling handling
        }
    }
56706
@SuppressWarnings("unchecked")
	private Map<String, Object> o(Object obj) {
		return (Map<String, Object>) obj;
	}
1150710
public static PyObject adapt(Object o) {
		if (o instanceof PyObject) {
			return (PyObject) o;
		}
		return Py.java2py(o);
	}
236371
public Configuration initializeConf(String[] keys,
      Configuration conf, FileSystem fs) throws IOException {
    Configuration newConf = new Configuration(conf);
    if (fs == null) {
      fs = FileSystem.get(conf);
    }
    String suffix = fs.getUri().getAuthority();
    for (String key: keys) {
      String value = conf.get(key + "." + suffix);
      if (value != null) {
        newConf.set(key, value);
      }
    }
    return newConf;
  }
419471
public boolean add(Object o) {

        resetCapacity();

        if (endindex == list.length) {
            endindex = 0;
        }

        list[endindex] = o;

        elementCount++;
        endindex++;

        return true;
    }
459586
public Node newOptionalParameterFromNode(Node n) {
    Node newParam = newParameterFromNode(n);
    if (!newParam.isVarArgs() && !newParam.isOptionalArg()) {
      newParam.setOptionalArg(true);
    }
    return newParam;
  }
567517
public static Reference getInstance(Object o, String key) {
	if (o instanceof Reference) {
	    return new ReferenceReference((Reference) o, key);
	}
	Collection coll = Caster.toCollection(o, null);
	if (coll != null) return new VariableReference(coll, key);
	return new NativeReference(o, key);
    }
1111544
def nx_gen_node_values(G, key, nodes, default=util_const.NoParam):
    
    node_dict = nx_node_dict(G)
    if default is util_const.NoParam:
        return (node_dict[n][key] for n in nodes)
    else:
        return (node_dict[n].get(key, default) for n in nodes)
591299
function(n) {
		if(this.config.title) {
			if(n == 0) {
				return this.config.title;
			} else if(n > 0 && n <= this.config.events.length) {
				return this.config.events[n - 1];
			}
		} else if(n >= 0 && n < this.config.events.length) {
			return this.config.events[n];
		}
		return null;
	}
200422
@Override
    public T get(int n) {
        checkUnsupportedOperationForIterationOnlyMode("get(int n)");
        
        while ( allResults.size() <= n && nextResultsAvailable() ) {
            moveNextResults(false);
        }

        return allResults.get(n);
    }
1248582
@Override
  public synchronized void init(PlayerConfig config) {
    super.init(config);
    String dictFileName = config.get(DICTIONARY_FILE_NAME_KEY);
    if (dictFileName == null || "".equals(dictFileName.trim())) {
      throw new IllegalArgumentException(this.getClass().getName() + " expects configuration property "
          + DICTIONARY_FILE_NAME_KEY);
    }
    File f = new File(dictFileName);
    if (!f.exists() || f.isDirectory()) {
      throw new IllegalArgumentException("Property " + DICTIONARY_FILE_NAME_KEY
          + " should designate existing dictionary file!");
    }
    BufferedReader bufferedReader = null;
    try {
      bufferedReader = new BufferedReader(new FileReader(f));
      while (true) {
        String phrase = bufferedReader.readLine();
        if (phrase != null) {
          DICTIONARY.add(phrase.trim());
        } else {
          break;
        }
      }
    } catch (IOException ioe) {
      throw new IllegalArgumentException("File " + f.getName() + " under key " + DICTIONARY_FILE_NAME_KEY
          + " not readable!");
    } finally {
      try {
        if (bufferedReader != null)
        bufferedReader.close();
      } catch (IOException ioe) {
        throw new RuntimeException(ioe);
      }
    }
  }
776238
@Override
  public String toSource(Node n) {
    initCompilerOptionsIfTesting();
    return toSource(n, null, true);
  }