org.unlaxer.util.collection.TreeNodeList Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of japanese-address-parser Show documentation
Show all versions of japanese-address-parser Show documentation
a simplejapanese address parser
The newest version!
package org.unlaxer.util.collection;
import java.util.List;
import java.util.Optional;
import java.util.function.Predicate;
import java.util.stream.Collectors;
public interface TreeNodeList extends List>{
public static TreeNodeList empty(){
return new TreeNodeListImpl();
}
public default Optional findAsContent(Predicate predicate){
for (int i = 0 ; i < size() ; i ++) {
TreeNode treeNode = get(i);
T content = treeNode.get();
if(predicate.test(content)) {
return Optional.of(content);
}
}
return Optional.empty();
}
public default Optional> find(Predicate predicate){
for (int i = 0 ; i < size() ; i ++) {
TreeNode treeNode = get(i);
T content = treeNode.get();
if(predicate.test(content)) {
return Optional.of(treeNode);
}
}
return Optional.empty();
}
public default List unwrap() {
return stream()
.map(TreeNode::get)
.collect(Collectors.toList());
}
} © 2015 - 2025 Weber Informatics LLC | Privacy Policy