本文整理汇总了Java中com.google.common.collect.ImmutableList.indexOf方法的典型用法代码示例。如果您正苦于以下问题:Java ImmutableList.indexOf方法的具体用法?Java ImmutableList.indexOf怎么用?Java ImmutableList.indexOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.ImmutableList
的用法示例。
在下文中一共展示了ImmutableList.indexOf方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: printFiltered
import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
private static void printFiltered(final String contents, final DayOfWeek dayOfWeek) {
final String nameOfDay = DAY_OF_WEEK_NAMES_MAP.get(dayOfWeek);
final ImmutableList<String> lines = ImmutableList.copyOf(NEWLINE.split(contents));
final int start = lines.indexOf(nameOfDay);
if (start < 0) {
logger.error("Not found for '{}' in pdf. (lines: {})", nameOfDay, lines);
return;
}
logger.info("Menu for {}", dayOfWeek);
lines.stream().skip(start).filter(line -> {
final int idx = line.indexOf(' ');
return (idx >= 0) && FOODS.contains(line.substring(0, idx));
}).forEachOrdered(msg -> {
logger.info("{}: {}", (Object[]) msg.split(" ", 2));
});
}
示例2: check
import com.google.common.collect.ImmutableList; //导入方法依赖的package包/类
@Check
protected void check() {
ImmutableList<String> names = propertyNames();
ImmutableSet<String> asSet = ImmutableSet.copyOf(names);
Preconditions.checkArgument(names.size()==asSet.size(),"property used more than once: %s",names);
int indexOfPageProperty = names.indexOf(PAGE);
Preconditions.checkArgument(indexOfPageProperty==-1 || indexOfPageProperty==(names.size()-1),"page property is not last in path: %s",names);
}