本文整理了Java中org.apache.commons.collections4.ListUtils.unmodifiableList()方法的一些代码示例,展示了
本文整理了Java中org.apache.commons.collections4.ListUtils.unmodifiableList()
方法的一些代码示例,展示了ListUtils.unmodifiableList()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ListUtils.unmodifiableList()
方法的具体详情如下:
包路径:org.apache.commons.collections4.ListUtils
类名称:ListUtils
方法名:unmodifiableList
ListUtils.unmodifiableList介绍
[英]Returns an unmodifiable list backed by the given list.
This method uses the implementation in the decorators subpackage.
[中]返回给定列表支持的不可修改列表。
此方法使用decorators子包中的实现。
代码示例
代码示例来源:origin: org.apache.commons/commons-collections4
/**
* {@inheritDoc}
*
* NOTE: from 4.0, an unmodifiable list will be returned, as changes to the
* subList can invalidate the parent list.
*/
@Override
public List subList(final int fromIndex, final int toIndex) {
final List superSubList = super.subList(fromIndex, toIndex);
final Set subSet = createSetBasedOnList(set, superSubList);
return ListUtils.unmodifiableList(new SetUniqueList<>(superSubList, subSet));
}
代码示例来源:origin: org.bitbucket.unaszole.xsdnormaliser/xmlstreameditor
public List getChildren()
{
return ListUtils.unmodifiableList(children);
}
public boolean isInDocument()
代码示例来源:origin: org.bitbucket.unaszole.xsdnormaliser/xmlstreameditor
public List getEventList()
{
return ListUtils.unmodifiableList(this.contents);
}
}
代码示例来源:origin: jtrfp/terminal-recall
@Override
public List getNullRunnables() {
return ListUtils.unmodifiableList(nullRunnables);
}
代码示例来源:origin: com.github.rvesse/airline
public static List unmodifiableListCopy(Collection collection) {
if (collection == null)
return Collections.emptyList();
return ListUtils.unmodifiableList(new ArrayList(collection));
}
代码示例来源:origin: com.github.rvesse/airline
public static List unmodifiableListCopy(T[] array) {
if (array == null)
return Collections.emptyList();
return ListUtils.unmodifiableList(Arrays.asList(array));
}
代码示例来源:origin: com.github.rvesse/airline
public List getAllOptions() {
List allOptiOns= new ArrayList();
allOptions.addAll(globalOptions);
allOptions.addAll(groupOptions);
allOptions.addAll(commandOptions);
return ListUtils.unmodifiableList(allOptions);
}
代码示例来源:origin: com.github.rvesse/airline
/**
* Parses the arguments to produce a command instance, this may be
* {@code null} if the arguments don't identify a command and there was no
* appropriate default command configured
*
* @param args
* Arguments
* @return Command instance
*/
public C parse(String... args) {
return parse(ListUtils.unmodifiableList(Arrays.asList(args)));
}
代码示例来源:origin: nikhilnanivadekar/CollectionsCompare
public List> dealHands(Deque shuffled, int hands, int cardsPerHand)
{
return ListUtils.unmodifiableList(
IntStream.range(0, hands)
.mapToObj(i -> this.deal(shuffled, cardsPerHand))
.collect(Collectors.toList()));
}
代码示例来源:origin: nikhilnanivadekar/CollectionsCompare
public List> dealHands(
Deque shuffled,
int hands,
int cardsPerHand)
{
return ListUtils.unmodifiableList(
IntStream.range(0, hands)
.mapToObj(i -> this.deal(shuffled, cardsPerHand))
.collect(Collectors.toList()));
}
代码示例来源:origin: com.github.rvesse/airline
public static List unmodifiableListCopy(Iterable iterable) {
if (iterable == null)
return Collections.emptyList();
return ListUtils.unmodifiableList(IteratorUtils.toList(iterable.iterator()));
}
代码示例来源:origin: net.peachjean.tater/tater-utils
private List createFieldList(TypeElement serviceElement) {
return ListUtils.unmodifiableList(CollectionUtils.collect(serviceElement.getEnclosedElements(),
new Transformer() {
@Override
public FieldDescriptor transform(Element enclosed) {
FieldDescriptor fieldDescriptor = enclosed.accept(AnnotationFieldVisitor.INSTANCE, utils);
return fieldDescriptor;
}
}, new ArrayList()));
}
代码示例来源:origin: com.github.rvesse/airline
public CliBuilder withCommands(Iterable> commands) {
this.defaultCommandGroupCommands.addAll(ListUtils.unmodifiableList(IteratorUtils.toList(commands.iterator())));
return this;
}
代码示例来源:origin: com.github.rvesse/airline
public Accessor(List path) {
if(path == null) throw new NullPointerException("path is null");
if (path.size() == 0) throw new IllegalArgumentException("path is empty");
this.path = ListUtils.unmodifiableList(path);
StringBuilder nameBuilder = new StringBuilder();
// Build the name for the accessor
nameBuilder.append(this.path.get(0).getDeclaringClass().getSimpleName());
for (Field field : this.path) {
nameBuilder.append('.').append(field.getName());
}
this.name = nameBuilder.toString();
Field field = this.path.get(this.path.size() - 1);
multiValued = Collection.class.isAssignableFrom(field.getType());
javaType = getItemType(name, field.getGenericType());
}
代码示例来源:origin: com.github.rvesse/airline
@SuppressWarnings("unchecked")
public CliBuilder withCommands(Class extends C> command, Class extends C>... moreCommands) {
this.defaultCommandGroupCommands.add(command);
this.defaultCommandGroupCommands
.addAll(ListUtils.unmodifiableList(IteratorUtils.toList(IteratorUtils.arrayIterator(moreCommands))));
return this;
}
代码示例来源:origin: com.github.rvesse/airline
@Override
public Iterable suggest() {
List suggestiOns= new ArrayList();
for (CommandMetadata command : group.getCommands()) {
suggestions.add(command.getName());
}
for (OptionMetadata option : group.getOptions()) {
suggestions.addAll(option.getOptions());
}
return ListUtils.unmodifiableList(suggestions);
}
}
代码示例来源:origin: apache/syncope
public List 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;
}
代码示例来源:origin: nikhilnanivadekar/CollectionsCompare
public ApacheCommonsDeckOfCards()
{
this.cards = ListUtils.unmodifiableList(
Card.streamCards().sorted().collect(Collectors.toList()));
ListValuedMap cbs = MultiMapUtils.newListValuedHashMap();
this.cards.forEach(card -> cbs.put(card.getSuit(), card));
this.cardsBySuit = MultiMapUtils.unmodifiableMultiValuedMap(cbs);
}
代码示例来源:origin: com.github.rvesse/airline
@Override
public Iterable suggest()
{
List suggestiOns= new ArrayList();
for (CommandGroupMetadata group : metadata.getCommandGroups()) {
suggestions.add(group.getName());
}
for (CommandMetadata command : metadata.getDefaultGroupCommands()) {
suggestions.add(command.getName());
}
for (OptionMetadata option : metadata.getOptions()) {
suggestions.addAll(option.getOptions());
}
return ListUtils.unmodifiableList(suggestions);
}
}
代码示例来源:origin: com.github.rvesse/airline
@Override
public Iterable suggest()
{
List suggestiOns= new ArrayList();
for (OptionMetadata option : command.getCommandOptions()) {
suggestions.addAll(option.getOptions());
}
if (command.getArguments() != null) {
// Include arguments separator
ParserMetadata> parserCOnfig= MetadataLoader.loadParser(command.getType());
suggestions.add(parserConfig.getArgumentsSeparator());
}
return ListUtils.unmodifiableList(suggestions);
}
}