本文整理汇总了Java中org.apache.commons.collections4.ListUtils.unmodifiableList方法的典型用法代码示例。如果您正苦于以下问题:Java ListUtils.unmodifiableList方法的具体用法?Java ListUtils.unmodifiableList怎么用?Java ListUtils.unmodifiableList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.collections4.ListUtils
的用法示例。
在下文中一共展示了ListUtils.unmodifiableList方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: subList
import org.apache.commons.collections4.ListUtils; //导入方法依赖的package包/类
/**
* {@inheritDoc}
* <p>
* NOTE: from 4.0, an unmodifiable list will be returned, as changes to the
* subList can invalidate the parent list.
*/
@Override
public List<E> subList(final int fromIndex, final int toIndex) {
final List<E> superSubList = super.subList(fromIndex, toIndex);
final Set<E> subSet = createSetBasedOnList(set, superSubList);
return ListUtils.unmodifiableList(new SetUniqueList<E>(superSubList, subSet));
}
示例2: getDomains
import org.apache.commons.collections4.ListUtils; //导入方法依赖的package包/类
public List<String> getDomains() {
synchronized (LOG) {
if (domains == null) {
domains = newClientFactory().create(
new AnonymousAuthenticationHandler(anonymousUser, anonymousKey)).
getService(DomainService.class).list().stream().map(EntityTO::getKey).
collect(Collectors.toList());
domains.add(0, SyncopeConstants.MASTER_DOMAIN);
domains = ListUtils.unmodifiableList(domains);
}
}
return domains;
}
示例3: findPredicateWord
import org.apache.commons.collections4.ListUtils; //导入方法依赖的package包/类
/**
* Find a word whose prefixes (including the word) conform to a given predicate and which itself also conforms
* to a second predicate.
*
* This method uses a depth-first search. A breath-first search would use more memory.
*
* @param a The automaton whose accepted words should get checked.
* @param prefixPredicate The predicate to check the prefixes.
* @param wordPredicate The predicate to check the words.
* @return A word which conforms to the predicates.
*/
static public List<String> findPredicateWord(FiniteAutomaton a, Predicate<List<String>> prefixPredicate,
Predicate<List<String>> wordPredicate) {
MinimalDeterministicFiniteAutomaton dfa = minimizeInternal(a);
Deque<Pair<DFAState, Iterator<Symbol>>> trace = new ArrayDeque<>();
LinkedList<String> word = new LinkedList<>();
DFAState initial = dfa.getInitialState();
DFAState sinkState = findSinkState(dfa);
trace.add(new Pair<>(initial, initial.getDefinedSymbols().iterator()));
while (!trace.isEmpty()) {
Pair<DFAState, Iterator<Symbol>> pair = trace.peekLast();
if (!pair.getSecond().hasNext()) {
trace.removeLast();
word.pollLast();
} else {
Symbol symbol = pair.getSecond().next();
DFAState nextState = pair.getFirst().getFollowingState(symbol);
if (!nextState.equals(sinkState)) {
word.add(symbol.getEvent());
List<String> roWord = ListUtils.unmodifiableList(word);
if (prefixPredicate.evaluate(roWord)) {
trace.addLast(new Pair<>(nextState,
nextState.getDefinedSymbols().iterator()));
if (nextState.isFinalState() && wordPredicate.evaluate(roWord))
return word;
} else {
word.removeLast();
}
}
}
}
return null;
}
示例4: getNullRunnables
import org.apache.commons.collections4.ListUtils; //导入方法依赖的package包/类
@Override
public List<Runnable> getNullRunnables() {
return ListUtils.unmodifiableList(nullRunnables);
}