Code example for HashMap

Methods: keySet

        // This is technically the set of packages on the originating handset 
        // that had backup agents at all, not limited to the set of packages 
        // that had actually contributed a restore dataset, but it's a 
        // close enough approximation for our purposes and does not require any 
        // additional involvement by the transport to obtain. 
        return mRestoredSignatures.keySet();
    // The backed up data is the signature block for each app, keyed by 
    // the package name. 
    public void onBackup(ParcelFileDescriptor oldState, BackupDataOutput data,
            ParcelFileDescriptor newState) {
        if (DEBUG) Slog.v(TAG, "onBackup()");
        ByteArrayOutputStream outputBuffer = new ByteArrayOutputStream();  // we'll reuse these
        DataOutputStream outputBufferStream = new DataOutputStream(outputBuffer);
        // If the stored version string differs, we need to re-backup all 
        // of the metadata.  We force this by removing everything from the 
        // "already backed up" map built by parseStateFile().