private Integer insertAllContacts(Iterator<String> contactsIter){
  final ArrayList<ContentProviderOperation> batchOperation=new ArrayList<ContentProviderOperation>();
  while (contactsIter.hasNext())   addContact(contactsIter.next(),batchOperation);
  try {
    ContentProviderResult[] results=mContentResolver.applyBatch(ContactsContract.AUTHORITY,batchOperation);
    return results.length / 2;
  }
 catch (  RemoteException e) {
    e.printStackTrace();
  }
catch (  OperationApplicationException e) {
    e.printStackTrace();
  }
  return 0;
}

private Integer insertAllContacts ( Iterator < String > contactsIter ) { final ArrayList < ContentProviderOperation > batchOperation = new ArrayList < ContentProviderOperation > ( ) ; while ( contactsIter . hasNext ( ) ) addContact ( contactsIter . next ( ) , batchOperation ) ; try { ContentProviderResult [ ] results = mContentResolver . applyBatch ( ContactsContract . AUTHORITY , batchOperation ) ; return results . length / 2 ; } catch ( RemoteException e ) { e . printStackTrace ( ) ; } catch ( OperationApplicationException e ) { e . printStackTrace ( ) ; } return 0 ; }
synchronously insert all contacts designated by the iterator .
