本文整理匯總了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);
}