Package org.gradle.util
Klasse CollectionUtils
java.lang.Object
org.gradle.util.CollectionUtils
Veraltet.
Will be removed in Gradle 9.0.
This class is only here to maintain binary compatibility with existing plugins.
Plugins should prefer external collection frameworks over this class.
Internally, all code should use CollectionUtils.
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenModifizierer und TypKlasseBeschreibungstatic classVeraltet.static classVeraltet.The result of diffing two sets. -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic <T,C extends Collection<? super T>>
CVeraltet.Utility for adding an iterable to a collection.static <T,C extends Collection<? super T>>
CaddAll(C t1, T... t2) Veraltet.Utility for adding an array to a collection.static <T> booleanVeraltet.static <T> booleanVeraltet.static StringasCommandLine(Iterable<String> arguments) Veraltet.static <T> Collection<? extends T> checkedCast(Class<T> type, Collection<?> input) Veraltet.static <R,I> List <R> collect(I[] list, Transformer<? extends R, ? super I> transformer) Veraltet.static <R,I, C extends Collection<R>>
Ccollect(Iterable<? extends I> source, C destination, Transformer<? extends R, ? super I> transformer) Veraltet.static <R,I> List <R> collect(Iterable<? extends I> source, Transformer<? extends R, ? super I> transformer) Veraltet.static <R,I> Set <R> collect(Set<? extends I> set, Transformer<? extends R, ? super I> transformer) Veraltet.static <R,I> R[] collectArray(I[] list, Class<R> newType, Transformer<? extends R, ? super I> transformer) Veraltet.static <R,I> R[] collectArray(I[] list, R[] destination, Transformer<? extends R, ? super I> transformer) Veraltet.static <K,V> Map <K, V> collectMap(Iterable<? extends V> items, Transformer<? extends K, ? super V> keyGenerator) Veraltet.Given a set of values, derive a set of keys and return a mapstatic <K,V> void collectMap(Map<K, V> destination, Iterable<? extends V> items, Transformer<? extends K, ? super V> keyGenerator) Veraltet.static <K,V> Map <K, V> collectMapValues(Iterable<? extends K> keys, Transformer<? extends V, ? super K> keyGenerator) Veraltet.Given a set of keys, derive a set of values and return a mapstatic <K,V> void collectMapValues(Map<K, V> destination, Iterable<? extends K> keys, Transformer<? extends V, ? super K> keyGenerator) Veraltet.static <E> List<E> Veraltet.static <T> CollectionUtils.SetDiff<T> diffSetsBy(Set<? extends T> left, Set<? extends T> right, Transformer<?, T> compareBy) Veraltet.Provides a "diff report" of how the two sets are similar and how they are different, comparing the entries by some aspect.static <T> booleanVeraltet.static <T,C extends Collection<T>>
CVeraltet.static <T> List<T> Veraltet.static <K,V> Map <K, V> Veraltet.static <K,V> Map <K, V> Veraltet.static <T> Set<T> Veraltet.static <T> List<T> Veraltet.static <T> TVeraltet.static <T> TVeraltet.static <T> TfindSingle(Iterable<T> source) Veraltet.Returns null if the collection is empty otherwise expects asingle(Iterable)element to be found.static <T> TVeraltet.static <T> List<T> flattenCollections(Class<T> type, Object... things) Veraltet.Recursively unpacks all the given things into a flat list, ensuring they are of a certain type.static List<?> flattenCollections(Object... things) Veraltet.Recursively unpacks all the given things into a flat list.static <K,V> Map <K, Collection<V>> groupBy(Iterable<? extends V> iterable, Transformer<? extends K, V> grouper) Veraltet.static <T,I> T inject(T target, Iterable<? extends I> items, Action<CollectionUtils.InjectionStep<T, I>> action) Veraltet.static <T> List<T> intersection(Collection<? extends Collection<T>> availableValuesByDescriptor) Veraltet.static StringVeraltet.Creates a string withtoString()of each object with the given separator.static StringVeraltet.Creates a string withtoString()of each object with the given separator.static <T> List<T> nonEmptyOrNull(Iterable<T> iterable) Veraltet.static <T> org.gradle.internal.Pair<Collection<T>, Collection<T>> Veraltet.Partition given Collection into a Pair of Collections.static <E> booleanreplace(List<E> list, Spec<? super E> filter, Transformer<? extends E, ? super E> transformer) Veraltet.static <T> TVeraltet.Returns the single element in the collection or throws.static <T> List<T> sort(Iterable<? extends T> things, Comparator<? super T> comparator) Veraltet.Returns a sorted copy of the provided collection of things.static <T extends Comparable<T>>
List<T> Veraltet.Returns a sorted copy of the provided collection of things.static <C extends Collection<String>>
CVeraltet.stringize(Collection<?> source) Veraltet.static <T> List<T> Veraltet.static <T> List<T> toList(Enumeration<? extends T> things) Veraltet.static <T> List<T> toList(T[] things) Veraltet.static <T> Set<T> Veraltet.toStringList(Iterable<?> iterable) Veraltet.static <T> Iterable<? extends T> Veraltet.
-
Konstruktordetails
-
CollectionUtils
public CollectionUtils()Veraltet.
-
-
Methodendetails
-
findSingle
Veraltet.Returns null if the collection is empty otherwise expects asingle(Iterable)element to be found. -
single
Veraltet.Returns the single element in the collection or throws. -
checkedCast
Veraltet. -
findFirst
Veraltet. -
findFirst
Veraltet. -
first
Veraltet. -
any
Veraltet. -
any
Veraltet. -
filter
Veraltet. -
filter
Veraltet. -
filter
Veraltet. -
sort
Veraltet.Returns a sorted copy of the provided collection of things. Uses the provided comparator to sort. -
sort
Veraltet.Returns a sorted copy of the provided collection of things. Uses the natural ordering of the things. -
filter
public static <T,C extends Collection<T>> C filter(Iterable<? extends T> source, C destination, Spec<? super T> filter) Veraltet. -
filter
Veraltet. -
filter
public static <K,V> Map<K,V> filter(Map<K, V> map, Map<K, V> destination, Spec<Map.Entry<K, V>> filter) Veraltet. -
collectArray
public static <R,I> R[] collectArray(I[] list, Class<R> newType, Transformer<? extends R, ? super I> transformer) Veraltet. -
collectArray
public static <R,I> R[] collectArray(I[] list, R[] destination, Transformer<? extends R, ? super I> transformer) Veraltet. -
collect
Veraltet. -
collect
public static <R,I> Set<R> collect(Set<? extends I> set, Transformer<? extends R, ? super I> transformer) Veraltet. -
collect
public static <R,I> List<R> collect(Iterable<? extends I> source, Transformer<? extends R, ? super I> transformer) Veraltet. -
collect
public static <R,I, C collectC extends Collection<R>> (Iterable<? extends I> source, C destination, Transformer<? extends R, ? super I> transformer) Veraltet. -
toStringList
Veraltet. -
flattenCollections
Veraltet.Recursively unpacks all the given things into a flat list. Nulls are not removed, they are left intact.- Parameter:
things- The things to flatten- Gibt zurück:
- A flattened list of the given things
-
flattenCollections
Veraltet.Recursively unpacks all the given things into a flat list, ensuring they are of a certain type. Nulls are not removed, they are left intact. If a non null object cannot be cast to the target type, a ClassCastException will be thrown.- Typparameter:
T- The target type in the flattened list- Parameter:
things- The things to flatten- Gibt zurück:
- A flattened list of the given things
-
toList
Veraltet. -
toList
Veraltet. -
intersection
public static <T> List<T> intersection(Collection<? extends Collection<T>> availableValuesByDescriptor) Veraltet. -
toList
Veraltet. -
toSet
Veraltet. -
compact
Veraltet. -
stringize
Veraltet. -
stringize
Veraltet. -
replace
public static <E> boolean replace(List<E> list, Spec<? super E> filter, Transformer<? extends E, ? super E> transformer) Veraltet. -
collectMap
public static <K,V> void collectMap(Map<K, V> destination, Iterable<? extends V> items, Transformer<? extends K, ? super V> keyGenerator) Veraltet. -
collectMap
public static <K,V> Map<K,V> collectMap(Iterable<? extends V> items, Transformer<? extends K, ? super V> keyGenerator) Veraltet.Given a set of values, derive a set of keys and return a map -
collectMapValues
public static <K,V> void collectMapValues(Map<K, V> destination, Iterable<? extends K> keys, Transformer<? extends V, ? super K> keyGenerator) Veraltet. -
collectMapValues
public static <K,V> Map<K,V> collectMapValues(Iterable<? extends K> keys, Transformer<? extends V, ? super K> keyGenerator) Veraltet.Given a set of keys, derive a set of values and return a map -
every
Veraltet. -
addAll
Veraltet.Utility for adding an iterable to a collection.- Typparameter:
T- The element type of t1- Parameter:
t1- The collection to add tot2- The iterable to add each item of to the collection- Gibt zurück:
- t1
-
addAll
Veraltet.Utility for adding an array to a collection.- Typparameter:
T- The element type of t1- Parameter:
t1- The collection to add tot2- The iterable to add each item of to the collection- Gibt zurück:
- t1
-
diffSetsBy
public static <T> CollectionUtils.SetDiff<T> diffSetsBy(Set<? extends T> left, Set<? extends T> right, Transformer<?, T> compareBy) Veraltet.Provides a "diff report" of how the two sets are similar and how they are different, comparing the entries by some aspect. The transformer is used to generate the value to use to compare the entries by. That is, the entries are not compared by equals by an attribute or characteristic. The transformer is expected to produce a unique value for each entry in a single set. Behaviour is undefined if this condition is not met.- Typparameter:
T- The type of the entry objects- Parameter:
left- The set on the "left" side of the comparison.right- The set on the "right" side of the comparison.compareBy- Provides the value to compare entries from either side by- Gibt zurück:
- A representation of the difference
-
join
Veraltet.Creates a string withtoString()of each object with the given separator.expect: join(",", new Object[]{"a"}) == "a" join(",", new Object[]{"a", "b", "c"}) == "a,b,c" join(",", new Object[]{}) == ""Theseparatormust not be null andobjectsmust not be null.- Parameter:
separator- The string by which to join each string representationobjects- The objects to join the string representations of- Gibt zurück:
- The joined string
-
join
Veraltet.Creates a string withtoString()of each object with the given separator.expect: join(",", ["a"]) == "a" join(",", ["a", "b", "c"]) == "a,b,c" join(",", []) == ""Theseparatormust not be null andobjectsmust not be null.- Parameter:
separator- The string by which to join each string representationobjects- The objects to join the string representations of- Gibt zurück:
- The joined string
-
partition
public static <T> org.gradle.internal.Pair<Collection<T>,Collection<T>> partition(Iterable<T> items, Spec<? super T> predicate) Veraltet.Partition given Collection into a Pair of Collections.Left
Collection containing entries that satisfy the given predicateRight
Collection containing entries that do NOT satisfy the given predicate -
inject
public static <T,I> T inject(T target, Iterable<? extends I> items, Action<CollectionUtils.InjectionStep<T, I>> action) Veraltet. -
groupBy
public static <K,V> Map<K,Collection<V>> groupBy(Iterable<? extends V> iterable, Transformer<? extends K, V> grouper) Veraltet. -
unpack
public static <T> Iterable<? extends T> unpack(Iterable<? extends org.gradle.internal.Factory<? extends T>> factories) Veraltet. -
nonEmptyOrNull
Veraltet. -
asCommandLine
Veraltet.
-