/** * {@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<>(superSubList, subSet)); }
public List<XMLElement> getChildren() { return ListUtils.unmodifiableList(children); } public boolean isInDocument()
public List<XMLEvent> getEventList() { return ListUtils.unmodifiableList(this.contents); } }
@Override public List<Runnable> getNullRunnables() { return ListUtils.unmodifiableList(nullRunnables); }
public static <T> List<T> unmodifiableListCopy(Collection<T> collection) { if (collection == null) return Collections.emptyList(); return ListUtils.unmodifiableList(new ArrayList<T>(collection)); }
public static <T> List<T> unmodifiableListCopy(T[] array) { if (array == null) return Collections.emptyList(); return ListUtils.unmodifiableList(Arrays.asList(array)); }
public List<OptionMetadata> getAllOptions() { List<OptionMetadata> allOptions = new ArrayList<OptionMetadata>(); allOptions.addAll(globalOptions); allOptions.addAll(groupOptions); allOptions.addAll(commandOptions); return ListUtils.unmodifiableList(allOptions); }
/** * 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))); }
public List<Set<Card>> dealHands(Deque<Card> shuffled, int hands, int cardsPerHand) { return ListUtils.unmodifiableList( IntStream.range(0, hands) .mapToObj(i -> this.deal(shuffled, cardsPerHand)) .collect(Collectors.toList())); }
public List<Set<Card>> dealHands( Deque<Card> shuffled, int hands, int cardsPerHand) { return ListUtils.unmodifiableList( IntStream.range(0, hands) .mapToObj(i -> this.deal(shuffled, cardsPerHand)) .collect(Collectors.toList())); }
public static <T> List<T> unmodifiableListCopy(Iterable<T> iterable) { if (iterable == null) return Collections.emptyList(); return ListUtils.unmodifiableList(IteratorUtils.toList(iterable.iterator())); }
private List<FieldDescriptor> createFieldList(TypeElement serviceElement) { return ListUtils.unmodifiableList(CollectionUtils.collect(serviceElement.getEnclosedElements(), new Transformer<Element, FieldDescriptor>() { @Override public FieldDescriptor transform(Element enclosed) { FieldDescriptor fieldDescriptor = enclosed.accept(AnnotationFieldVisitor.INSTANCE, utils); return fieldDescriptor; } }, new ArrayList<FieldDescriptor>())); }
public CliBuilder<C> withCommands(Iterable<Class<? extends C>> commands) { this.defaultCommandGroupCommands.addAll(ListUtils.unmodifiableList(IteratorUtils.toList(commands.iterator()))); return this; }
public Accessor(List<Field> 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()); }
@SuppressWarnings("unchecked") public CliBuilder<C> 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; }
@Override public Iterable<String> suggest() { List<String> suggestions = new ArrayList<String>(); for (CommandMetadata command : group.getCommands()) { suggestions.add(command.getName()); } for (OptionMetadata option : group.getOptions()) { suggestions.addAll(option.getOptions()); } return ListUtils.unmodifiableList(suggestions); } }
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; }
public ApacheCommonsDeckOfCards() { this.cards = ListUtils.unmodifiableList( Card.streamCards().sorted().collect(Collectors.toList())); ListValuedMap<Suit, Card> cbs = MultiMapUtils.newListValuedHashMap(); this.cards.forEach(card -> cbs.put(card.getSuit(), card)); this.cardsBySuit = MultiMapUtils.unmodifiableMultiValuedMap(cbs); }
@Override public Iterable<String> suggest() { List<String> suggestions = new ArrayList<String>(); 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); } }
@Override public Iterable<String> suggest() { List<String> suggestions = new ArrayList<String>(); 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); } }