moe.maple.api.script.model.object.data.provider.DataProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of script-api Show documentation
Show all versions of script-api Show documentation
A java MapleStory(🍁) scripting api.
The newest version!
package moe.maple.api.script.model.object.data.provider;
import moe.maple.api.script.model.object.data.safety.DataValidator;
import java.util.Collection;
import java.util.Optional;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author umbreon22
* Created on 8/21/2019.
*/
public interface DataProvider extends DataValidator {
/**
* @return A stream of {@link Key}
*/
Stream keyStream();
/**
* @return A stream of {@link Value}
*/
Stream valueStream();
/**
* @param key A {@link Key}
* @return An {@link Optional} from {@link Key}
*/
Optional get(Key key);
/**
* @param filter A {@link Predicate} filter
* @return A collection if {@link Value} that passes the predicate test.
*/
default Collection getAll(Predicate filter) {
return valueStream().filter(filter).collect(Collectors.toSet());
}
/**
* @return A collection of all {@link Value}
*/
default Collection getAll() {
return valueStream().collect(Collectors.toSet());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy