### Question:
MapDBObject implements DBObject { @Override public final void putAll(BSONObject o) { this.delegateMap.putAll(o.toMap()); } MapDBObject();  MapDBObject(Map<String, Object> map); @Override final Object put( String key , Object value ); @Override final void putAll(BSONObject o); @Override final void putAll(Map m); @SuppressWarnings({ "rawtypes", "unchecked" }) final void putAll(Object obj); @Override final Object get(String key); @Override final Map toMap(); @Override final Object removeField(String key); @Override final boolean containsKey(String key); @Override final boolean containsField(String key); @Override final Set<String> keySet(); @Override void markAsPartialObject(); @Override boolean isPartialObject(); @Override String toString();  }### Answer:
@Test public void testPutAll() { PropData propData = new PropData(); propData.setName("夺命刀"); propData.setBanded(true); propData.setValuetype(PropDataValueType.BONUS); MapDBObject mapDBObject = new MapDBObject(); mapDBObject.putAll(propData); assertEquals("夺命刀", mapDBObject.get("name")); assertEquals(Boolean.TRUE, mapDBObject.get("banded")); assertEquals("BONUS", mapDBObject.get("valuetype")); assertEquals(null, mapDBObject.get("serialVersionUID")); }
@Test public void testPutAllObject() { PropData propData = new PropData(); propData.setName("夺命刀"); propData.setBanded(true); propData.setValuetype(PropDataValueType.BONUS); int max = 100000; long startM = System.currentTimeMillis(); try { for ( int i=0; i<max; i++ ) { MapDBObject dbObject = new MapDBObject(); dbObject.putAll(makePropData(propData, i)); } } catch (Exception e) { e.printStackTrace(); } long endM = System.currentTimeMillis(); System.out.println("MapDBObject.putAll(Object) loop " + max + ", time: " + (endM-startM)); startM = System.currentTimeMillis(); try { for ( int i=0; i<max; i++ ) { putDBObject(makePropData(propData, i)); } } catch (Exception e) { e.printStackTrace(); } endM = System.currentTimeMillis(); System.out.println("MapDBObject.putHash(Object) loop " + max + ", time: " + (endM-startM)); }