Returns an iterator for the hash map keys that is not changed by parallel changes to the hash map. - Java java.util

Java examples for java.util:Map Operation

Description

Returns an iterator for the hash map keys that is not changed by parallel changes to the hash map.

Demo Code


//package com.java2s;

import java.util.HashMap;

import java.util.Iterator;

public class Main {
    /**/*from  w  ww.  j av a2s.c o  m*/
     * Returns an iterator for the hash map keys that is not changed by parallel changes to the hash map.
     * 
     * @param hashMap
     * @return
     */
    public static Iterator getPersistentKeysIterator(HashMap hashMap) {
        return ((HashMap) hashMap.clone()).keySet().iterator();
    }
}

Related Tutorials