### Question:
TransactUtils { public static <T extends DataObject> Map<InstanceIdentifier<T>,T> extract( Map<InstanceIdentifier<?>, DataObject> changes, Class<T> klazz) { Map<InstanceIdentifier<T>,T> result = new HashMap<>(); if (changes != null) { for (Entry<InstanceIdentifier<?>, DataObject> created : changes.entrySet()) { if (klazz.isInstance(created.getValue())) { @SuppressWarnings("unchecked") T value = (T) created.getValue(); Class<?> type = created.getKey().getTargetType(); if (type.equals(klazz)) { @SuppressWarnings("unchecked") InstanceIdentifier<T> iid = (InstanceIdentifier<T>) created.getKey(); result.put(iid, value); } } } } return result; } private  TransactUtils(); static Map<InstanceIdentifier<Node>,Node> extractNode(
            Map<InstanceIdentifier<?>, DataObject> changes); static Map<InstanceIdentifier<T>,T> extractCreated(
            DataChangeEvent changes, Class<T> klazz); static Map<InstanceIdentifier<T>, T> extractCreated(
            Collection<DataTreeModification<U>> changes, Class<T> clazz); static Map<InstanceIdentifier<T>,T> extractUpdated(
            DataChangeEvent changes, Class<T> klazz); static Map<InstanceIdentifier<T>, T> extractUpdated(
            Collection<DataTreeModification<U>> changes, Class<T> clazz); static Map<InstanceIdentifier<T>, T> extractCreatedOrUpdated(
            Collection<DataTreeModification<U>> changes, Class<T> clazz,
            Predicate<DataObjectModification<T>> filter); static Map<InstanceIdentifier<T>,T> extractCreatedOrUpdated(
            DataChangeEvent changes,Class<T> klazz); static Map<InstanceIdentifier<T>, T> extractCreatedOrUpdated(
            Collection<DataTreeModification<U>> changes, Class<T> clazz); static Map<InstanceIdentifier<T>, T> extractCreatedOrUpdatedOrRemoved(
            DataChangeEvent changes, Class<T> klazz); static Map<InstanceIdentifier<T>, T> extractCreatedOrUpdatedOrRemoved(
            Collection<DataTreeModification<U>> changes, Class<T> clazz); static Map<InstanceIdentifier<T>,T> extractOriginal(
            DataChangeEvent changes, Class<T> klazz); static Map<InstanceIdentifier<T>, T> extractOriginal(
            Collection<DataTreeModification<U>> changes, Class<T> clazz); static Set<InstanceIdentifier<T>> extractRemoved(
            DataChangeEvent changes, Class<T> klazz); static Set<InstanceIdentifier<T>> extractRemoved(
            Collection<DataTreeModification<U>> changes, Class<T> clazz); static Map<InstanceIdentifier<T>, T> extractRemovedObjects(
            DataChangeEvent changes, Class<T> klazz); static Map<InstanceIdentifier<T>, T> extractRemovedObjects(
            Collection<DataTreeModification<U>> changes, Class<T> clazz); static Map<InstanceIdentifier<T>,T> extract(
            Map<InstanceIdentifier<?>, DataObject> changes, Class<T> klazz); static List<Insert> extractInsert(TransactionBuilder transaction, GenericTableSchema schema); static UUID extractNamedUuid(Insert insert); static void stampInstanceIdentifier(TransactionBuilder transaction,
            InstanceIdentifier<?> iid, TableSchema<T> tableSchema, ColumnSchema<T, Map<String, String>> columnSchema,
            InstanceIdentifierCodec instanceIdentifierCodec); static Mutate<T> stampInstanceIdentifierMutation(TransactionBuilder transaction,
            InstanceIdentifier<?> iid, TableSchema<T> tableSchema, ColumnSchema<T, Map<String, String>> columnSchema,
            InstanceIdentifierCodec instanceIdentifierCodec); static String bytesToHexString(byte[] bytes);  }### Answer:
@Test public void testExtract() { Map<InstanceIdentifier<?>, DataObject> changes = new HashMap<>(); Class<DataObject> klazz = DataObject.class; assertEquals(HashMap.class, TransactUtils.extract(changes, klazz).getClass()); }