Code example for ConcurrentLinkedQueue

0
/** 
 * @author Rick Dane 
 */ 
public class FinalOutputContainerImpl implements FinalOutputContainer { 
 
    private Queue<Map<String, ContainerBase>> finalOutputContainer = new ConcurrentLinkedQueue<Map<String, ContainerBase>>();
 
    public void addToFinalOutputContainer(String identifier, ContainerBase cb) {
        Map<String, ContainerBase> map = new HashMap<String, ContainerBase>();
        map.put(identifier, cb);
        finalOutputContainer.add(map);
 
    } 
 
    public Map<String, ContainerBase> removeFromFinalOutputContainer() {
        if (!finalOutputContainer.isEmpty()) {
            try { 
                return finalOutputContainer.remove();
            } catch (Exception e) {
                e.printStackTrace();
            }