Skip to content
Snippets Groups Projects
Commit 31c4ba40 authored by Christian Wulf's avatar Christian Wulf
Browse files

fixed bug in FileExtensionSwitch

parent 2fab9fd9
No related branches found
No related tags found
No related merge requests found
package teetime.stage;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import teetime.framework.AbstractConsumerStage;
import teetime.framework.OutputPort;
import teetime.util.HashMapWithDefault;
import teetime.util.concurrent.hashmap.ValueFactory;
import com.google.common.io.Files;
public final class FileExtensionSwitch extends AbstractConsumerStage<File> {
private final Map<String, OutputPort<File>> fileExtensions = new HashMap<String, OutputPort<File>>();
private final OutputPort<File> unknownFileExtensionOutputPort = createOutputPort();
// BETTER use the hppc ObjectObjectMap that provide getOrDefault()
private final Map<String, OutputPort<File>> fileExtensions = new HashMapWithDefault<String, OutputPort<File>>(new ValueFactory<OutputPort<File>>() {
@Override
public OutputPort<File> create() {
return unknownFileExtensionOutputPort;
}
});
@Override
protected void execute(final File file) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment