本文整理匯總了Java中org.springframework.util.CollectionUtils.findFirstMatch方法的典型用法代碼示例。如果您正苦於以下問題:Java CollectionUtils.findFirstMatch方法的具體用法?Java CollectionUtils.findFirstMatch怎麽用?Java CollectionUtils.findFirstMatch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.util.CollectionUtils
的用法示例。
在下文中一共展示了CollectionUtils.findFirstMatch方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: checkNameUniqueness
import org.springframework.util.CollectionUtils; //導入方法依賴的package包/類
/**
* Validate that the specified bean name and aliases have not been used already.
*/
private boolean checkNameUniqueness(String beanName, Collection<String> aliases, Collection<String> usedNames) {
String foundName = null;
if (StringUtils.hasText(beanName) && usedNames.contains(beanName)) {
foundName = beanName;
}
if (foundName == null) {
foundName = (String) CollectionUtils.findFirstMatch(usedNames, aliases);
}
usedNames.add(beanName);
usedNames.addAll(aliases);
return (foundName != null);
}
示例2: checkNameUniqueness
import org.springframework.util.CollectionUtils; //導入方法依賴的package包/類
/**
* Validate that the specified bean name and aliases have not been used already
* within the current level of beans element nesting.
*/
protected void checkNameUniqueness(String beanName, List<String> aliases, Element beanElement) {
String foundName = null;
if (StringUtils.hasText(beanName) && this.usedNames.contains(beanName)) {
foundName = beanName;
}
if (foundName == null) {
foundName = CollectionUtils.findFirstMatch(this.usedNames, aliases);
}
if (foundName != null) {
error("Bean name '" + foundName + "' is already used in this <beans> element", beanElement);
}
this.usedNames.add(beanName);
this.usedNames.addAll(aliases);
}