com.iodesystems.fn.data.Indexer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fn Show documentation
Show all versions of fn Show documentation
Fn is a lazy Java Library that helps utilize some rudimentary functional concepts with more nounular
objects
package com.iodesystems.fn.data;
import java.util.HashMap;
import java.util.Map;
public abstract class Indexer implements From {
public static Map index(Iterable source, From extractor) {
Map index = new HashMap<>();
if (source != null) {
for (V v : source) {
index.put(extractor.from(v), v);
}
}
return index;
}
public Map index(Iterable source) {
return index(source, this);
}
}