private synchronized void
addElement(Name name, Element element) {
	Object types = data.get(name);
	if (types == null) {
		data.put(name, element);
		return;
	}
	int type = element.getType();
	if (types instanceof List) {
		List list = (List) types;
		for (int i = 0; i < list.size(); i++) {
			Element elt = (Element) list.get(i);
			if (elt.getType() == type) {
				list.set(i, element);
				return;
			}
		}
		list.add(element);
	} else {
		Element elt = (Element) types;
		if (elt.getType() == type)
			data.put(name, element);
		else {
			LinkedList list = new LinkedList();
			list.add(elt);
			list.add(element);
			data.put(name, list);
		}
	}
}
Creates a Cache which initially contains all records in the specified file.
src/main/java/core/org/xbill/DNS/Cache.java