com.dooapp.gaedo.prevalence.space.commands.IterateOverCollection Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gaedo-prevalence Show documentation
Show all versions of gaedo-prevalence Show documentation
A gaedo-inspired prevalence layer and the associated service, for making the most gaedo-efficient use of that layer
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