/** * Puts all the mappings from the specified map into this map. * <p> * All keys and values must implement <code>Comparable</code>. * * @param map the map to copy from */ @Override public void putAll(final Map<? extends K, ? extends V> map) { for (final Map.Entry<? extends K, ? extends V> e : map.entrySet()) { put(e.getKey(), e.getValue()); } }
/** * Reads the content of the stream. * * @param stream the input stream * @throws IOException if an error occurs while reading from the stream * @throws ClassNotFoundException if an object read from the stream can not be loaded */ @SuppressWarnings("unchecked") // This will fail at runtime if the stream is incorrect private void readObject(final ObjectInputStream stream) throws IOException, ClassNotFoundException{ stream.defaultReadObject(); rootNode = new Node[2]; final int size = stream.readInt(); for(int i = 0; i < size; i++){ final K k =(K) stream.readObject(); final V v =(V) stream.readObject(); put(k, v); } }
/** * Puts a {@link CustomProperty} into this map. It is assumed that the * {@link CustomProperty} already has a valid ID. Otherwise use * {@link #put(CustomProperty)}. * * @param name the property name * @param cp the property * * @return the previous property stored under this name */ public CustomProperty put(final String name, final CustomProperty cp) { if (name == null) { /* Ignoring a property without a name. */ isPure = false; return null; } if (!name.equals(cp.getName())) { throw new IllegalArgumentException("Parameter \"name\" (" + name + ") and custom property's name (" + cp.getName() + ") do not match."); } checkCodePage(name); /* Register name and ID in the dictionary. Mapping in both directions is possible. If there is already a */ props.remove(dictionary.getKey(name)); dictionary.put(cp.getID(), name); /* Put the custom property into this map. */ return props.put(cp.getID(), cp); }
offset2Id.put(off, id);
/** * Puts a {@link CustomProperty} into this map. It is assumed that the * {@link CustomProperty} already has a valid ID. Otherwise use * {@link #put(CustomProperty)}. * * @param name the property name * @param cp the property * * @return the previous property stored under this name */ public CustomProperty put(final String name, final CustomProperty cp) { if (name == null) { /* Ignoring a property without a name. */ isPure = false; return null; } if (!name.equals(cp.getName())) { throw new IllegalArgumentException("Parameter \"name\" (" + name + ") and custom property's name (" + cp.getName() + ") do not match."); } checkCodePage(name); /* Register name and ID in the dictionary. Mapping in both directions is possible. If there is already a */ props.remove(dictionary.getKey(name)); dictionary.put(cp.getID(), name); /* Put the custom property into this map. */ return props.put(cp.getID(), cp); }
offset2Id.put(off, id);