public final class CollectionTools extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> boolean |
containsOnlySameValue(Collection<T> collection,
T value)
Test if all collection's values contain always the same value
|
static boolean |
containsWithValue(Collection<? extends Object> collection,
String pathToProperty,
BeanTools.AccessType accessType,
Object value)
Check in a collection of beans if a property has a specific value
|
static int |
countWithValue(Collection<? extends Object> collection,
String pathToProperty,
BeanTools.AccessType accessType,
Object value)
Count in a collection of beans the number of beans which have a specific value
|
static <T> T |
findWithValue(List<T> collection,
String pathToProperty,
BeanTools.AccessType accessType,
Object value)
Get from a beans collection the first bean which have a property with a specific value.
|
static <T> Set<T> |
intersect(Set<T> s1,
Set<T> s2)
Intersection of two sets
|
static boolean |
removeAllWithValue(Collection<? extends Object> collection,
String pathToProperty,
BeanTools.AccessType accessType,
Collection<? extends Object> values)
Remove in a collection of beans the beans which have a specifics values.
|
static boolean |
removeWithValue(Collection<? extends Object> collection,
String pathToProperty,
BeanTools.AccessType accessType,
Object value)
Remove in a collection of beans the beans which have a specific value.
|
static <T> void |
setter(Collection<T> collectionToWrite,
Collection<T> collectionToRead)
Setter for collections, preserving the instance
|
static List<Object> |
valuesFromList(Collection<? extends Object> collection,
String pathToProperty,
BeanTools.AccessType accessType)
Build a list from values properties of a bean list.
|
public static <T> boolean containsOnlySameValue(Collection<T> collection, T value)
T - Collection typecollection - Collection to parsevalue - Value which is tested for the identity (may be null)public static <T> Set<T> intersect(Set<T> s1, Set<T> s2)
T - Set types1 - Set 1s2 - Set 2public static <T> void setter(Collection<T> collectionToWrite, Collection<T> collectionToRead)
T - Collection typecollectionToWrite - Collection to writecollectionToRead - Collection to readpublic static boolean containsWithValue(Collection<? extends Object> collection, String pathToProperty, BeanTools.AccessType accessType, Object value)
collection - The collection to parsepathToProperty - The path to the tested bean property (for each bean in the collection), example :
beanX.beanY.propZaccessType - The access type to reach each property valuevalue - The value to findpublic static int countWithValue(Collection<? extends Object> collection, String pathToProperty, BeanTools.AccessType accessType, Object value)
collection - The collection to parsepathToProperty - The path to the tested bean property, example : beanX.beanY.propZaccessType - The access type to reach each property valuevalue - The value to findpublic static <T> T findWithValue(List<T> collection, String pathToProperty, BeanTools.AccessType accessType, Object value)
T - The beans class in the collectioncollection - The collection to parsepathToProperty - The path to the tested bean property, example : beanX.beanY.propZaccessType - The access type to reach each property valuevalue - The value to findpublic static boolean removeWithValue(Collection<? extends Object> collection, String pathToProperty, BeanTools.AccessType accessType, Object value)
collection - The collection to parsepathToProperty - The path to the tested bean property, example : beanX.beanY.propZaccessType - The access type to reach each property valuevalue - The value to findpublic static boolean removeAllWithValue(Collection<? extends Object> collection, String pathToProperty, BeanTools.AccessType accessType, Collection<? extends Object> values)
collection - The collection to parsepathToProperty - The path to the tested bean property, example : beanX.beanY.propZaccessType - The access type to reach each property valuevalues - The values to findpublic static List<Object> valuesFromList(Collection<? extends Object> collection, String pathToProperty, BeanTools.AccessType accessType)
collection - The beans list to parsepathToProperty - The path to the bean property, example : beanX.beanY.propZaccessType - The access type to reach each property valueCopyright © 2009-2013 IRD. All Rights Reserved.