All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dooapp.gaedo.prevalence.space.commands.IterateOverCollection Maven / Gradle / Ivy

Go to download

A gaedo-inspired prevalence layer and the associated service, for making the most gaedo-efficient use of that layer

There is a newer version: 1.0.16
Show newest version
package com.dooapp.gaedo.prevalence.space.commands;

import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;

import com.dooapp.gaedo.prevalence.space.Command;
import com.dooapp.gaedo.prevalence.space.StorageSpace;

public class IterateOverCollection
		implements Command, Key>, Serializable {

	private Key key;

	public IterateOverCollection(Key storageName) {
		this.key = storageName;
	}

	/**
	 * Create a read-only copy of content to iterate over it (in order to avoid the classical bug of the ConcurrentModificationException)
	 */
	@Override
	public Iterable execute(StorageSpace storage) {
		return Collections.unmodifiableCollection(new LinkedList((Collection) storage.get(key)));
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy