# NamedDomainObjectList

@ManagedType
interface NamedDomainObjectList<T> : NamedDomainObjectCollection<T> , List<T> (source)

A specialization of org.gradle.api.NamedDomainObjectCollection that also implements java.util.List.

All object equality is determined in terms of object names. That is, calling `remove()` with an object that is NOT equal to an existing object in terms of `equals`, but IS in terms of name equality will result in the existing collection item with the equal name being removed.

#### Parameters

<T>

The type of objects in the list

#### See also

ManagedType

Create an instance of this as a managed property (preferred).

ObjectFactory

Create an instance of this manually.

#### Inheritors

ArtifactRepositoryContainer

## Functions

add
Link copied to clipboard
abstract fun add(p: E): Boolean
abstract fun add(p: Int, p1: E)
abstract fun add(e: T): Boolean
Adds an object to the collection, if there is no existing object in the collection with the same name.
addAll
Link copied to clipboard
abstract fun addAll(p: Collection<out E>): Boolean
abstract fun addAll(c: Collection<out T>): Boolean
Adds any of the given objects to the collection that do not have the same name as any existing element.
addAllLater
Link copied to clipboard
abstract fun addAllLater(provider: Provider<out Iterable<T>>)
Adds elements to this collection, given a Provider of Iterable that will provide the elements when required.
addLater
Link copied to clipboard
abstract fun addLater(provider: Provider<out T>)
Adds an element to this collection, given a Provider that will provide the element when required.
addRule
Link copied to clipboard
abstract fun addRule(rule: Rule): Rule
abstract fun addRule(description: String, ruleAction: Closure): Rule
abstract fun addRule(description: String, ruleAction: Action<String>): Rule
Adds a rule to this collection.
all
Link copied to clipboard
abstract fun all(action: Closure)
Executes the given closure against all objects in this collection, and any objects subsequently added to this collection.
abstract fun all(action: Action<in T>)
Executes the given action against all objects in this collection, and any objects subsequently added to this collection.
clear
Link copied to clipboard
abstract fun clear()
configureEach
Link copied to clipboard
abstract fun configureEach(action: Action<in T>)
Configures each element in this collection using the given action, as each element is required.
contains
Link copied to clipboard
abstract fun contains(p: Any): Boolean
containsAll
Link copied to clipboard
abstract fun containsAll(p: Collection<out Any>): Boolean
copyOf
Link copied to clipboard
open fun <E> copyOf(coll: Collection<out E>): List<E>
disallowChanges
Link copied to clipboard
@Incubating
open fun disallowChanges()
Disallows further structural modifications to this collection.
equals
Link copied to clipboard
abstract fun equals(p: Any): Boolean
findAll
Link copied to clipboard
abstract fun findAll(spec: Closure): List<T>
Returns a collection which contains the objects in this collection which meet the given closure specification.
findByName
Link copied to clipboard
@Nullable
abstract fun findByName(name: String): @Nullable T
Locates an object by name, returning null if there is no such object.
forEach
Link copied to clipboard
open fun forEach(action: Consumer<in T>)
get
Link copied to clipboard
abstract fun get(p: Int): E
getAsMap
Link copied to clipboard
abstract fun getAsMap(): SortedMap<String, T>
Returns the objects in this collection, as a map from object name to object instance.
getAt
Link copied to clipboard
abstract fun getAt(name: String): T
Locates an object by name, failing if there is no such object.
getByName
Link copied to clipboard
abstract fun getByName(name: String): T
abstract fun getByName(name: String, configureClosure: Closure): T
abstract fun getByName(name: String, configureAction: Action<in T>): T
Locates an object by name, failing if there is no such object.
getCollectionSchema
Link copied to clipboard
@Internal
abstract fun getCollectionSchema(): NamedDomainObjectCollectionSchema
Provides access to the schema of all created or registered named domain objects in this collection.
getNamer
Link copied to clipboard
abstract fun getNamer(): Namer<T>
An object that represents the naming strategy used to name objects of this collection.
getNames
Link copied to clipboard
abstract fun getNames(): SortedSet<String>
Returns the names of the objects in this collection as a Set of Strings.
getRules
Link copied to clipboard
abstract fun getRules(): List<Rule>
Returns the rules used by this collection.
hashCode
Link copied to clipboard
abstract fun hashCode(): Int
indexOf
Link copied to clipboard
abstract fun indexOf(p: Any): Int
isEmpty
Link copied to clipboard
abstract fun isEmpty(): Boolean
iterator
Link copied to clipboard
abstract fun iterator(): Iterator<T>
abstract fun iterator(): Iterator<E>
lastIndexOf
Link copied to clipboard
abstract fun lastIndexOf(p: Any): Int
listIterator
Link copied to clipboard
abstract fun listIterator(): ListIterator<E>
matching
Link copied to clipboard
abstract fun matching(spec: Closure): DomainObjectCollection<T>
Returns a collection which contains the objects in this collection which meet the given closure specification.
abstract fun matching(spec: Spec<in T>): DomainObjectCollection<T>
Returns a collection which contains the objects in this collection which meet the given specification.
abstract fun matching(spec: Closure): NamedDomainObjectList<T>
abstract fun matching(spec: Spec<in T>): NamedDomainObjectList<T>
named
Link copied to clipboard
abstract fun named(name: String): NamedDomainObjectProvider<T>
abstract fun named(name: String, configurationAction: Action<in T>): NamedDomainObjectProvider<T>
Locates a object by name, failing if there is no such object.
abstract fun <S : T?> named(name: String, type: Class<S>): NamedDomainObjectProvider<S>
abstract fun <S : T?> named(name: String, type: Class<S>, configurationAction: Action<in S>): NamedDomainObjectProvider<S>
Locates a object by name and type, failing if there is no such object.
abstract fun named(nameFilter: Spec<String>): NamedDomainObjectList<T>
Returns a collection containing the objects with names matching the provided filter.
of
Link copied to clipboard
open fun <E> of(): List<E>
parallelStream
Link copied to clipboard
open fun parallelStream(): Stream<E>
remove
Link copied to clipboard
abstract fun remove(p: Int): E
abstract fun remove(p: Any): Boolean
removeAll
Link copied to clipboard
abstract fun removeAll(p: Collection<out Any>): Boolean
removeIf
Link copied to clipboard
open fun removeIf(filter: Predicate<in E>): Boolean
replaceAll
Link copied to clipboard
open fun replaceAll(operator: UnaryOperator<E>)
retainAll
Link copied to clipboard
abstract fun retainAll(p: Collection<out Any>): Boolean
set
Link copied to clipboard
abstract fun set(p: Int, p1: E): E
size
Link copied to clipboard
abstract fun size(): Int
sort
Link copied to clipboard
open fun sort(c: Comparator<in E>)
spliterator
Link copied to clipboard
open fun spliterator(): Spliterator<T>
open fun spliterator(): Spliterator<E>
stream
Link copied to clipboard
open fun stream(): Stream<E>
subList
Link copied to clipboard
abstract fun subList(p: Int, p1: Int): List<E>
toArray
Link copied to clipboard
abstract fun toArray(): Array<Any>
abstract fun <T> toArray(p: Array<T>): Array<T>
whenObjectAdded
Link copied to clipboard
abstract fun whenObjectAdded(action: Closure)
Adds a closure to be called when an object is added to this collection.
abstract fun whenObjectAdded(action: Action<in T>): Action<in T>
Adds an `Action` to be executed when an object is added to this collection.
whenObjectRemoved
Link copied to clipboard
abstract fun whenObjectRemoved(action: Closure)
Adds a closure to be called when an object is removed from this collection.
abstract fun whenObjectRemoved(action: Action<in T>): Action<in T>
Adds an `Action` to be executed when an object is removed from this collection.
withType
Link copied to clipboard
abstract fun <S : T?> withType(type: Class<S>): DomainObjectCollection<S>
abstract fun <S : T?> withType(type: Class<S>, @DelegatesTo(genericTypeIndex = 0) configureClosure: Closure): DomainObjectCollection<S>
abstract fun <S : T?> withType(type: Class<S>, configureAction: Action<in S>): DomainObjectCollection<S>
Returns a collection containing the objects in this collection of the given type.
abstract fun <S : T?> withType(type: Class<S>): NamedDomainObjectList<S>