public final class ListExtensions
extends java.lang.Object
List objects.| Modifier and Type | Method and Description |
|---|---|
static <T> boolean |
containAtleastOneObject(java.util.List<T> toSearch,
java.util.List<T> search)
This Method look in the List toSearch if at least one Object exists in the List search.
|
static java.util.List<java.util.List<java.lang.Integer>> |
getAllCombinations(java.util.List<java.lang.Integer> possibleNumbers,
int combinationSize)
Gets all possible combinations from the given list of
Integer objects |
static <T> java.util.List<java.util.List<T>> |
getCombinations(java.util.List<T> possibleValues,
int combinationSize)
Gets all possible combinations from the given list
|
static <T> T |
getFirst(java.util.List<T> list)
Gets the first object from the given List.
|
static <T> T |
getLast(java.util.List<T> list)
Gets the last object from the given List.
|
static <T> ModifiedCollections<T> |
getModifiedCollections(java.util.Collection<T> previous,
java.util.Collection<T> next)
Gets the modified lists. finding from an old list which elements have been removed and which
have been added.
|
static <T> java.util.List<T> |
getSameElementsFromLists(java.util.List<T> toSearch,
java.util.List<T> search)
This method decorates the retainAll method and returns the result in a new list
|
static <T> boolean |
hasNext(java.util.List<T> list,
T element)
Checks if the given
List has a next element from the given element |
static <T> boolean |
hasPrevious(java.util.List<T> list,
T element)
Checks if the given
List has a next element from the given element |
static <T> boolean |
isEqualListOfArrays(java.util.List<T[]> one,
java.util.List<T[]> other)
Compare the given two
Collection objects in equality. |
static <T> boolean |
isFirst(java.util.List<T> list,
T element)
Checks if the given element is the first in the given list.
|
static <T> boolean |
isLast(java.util.List<T> list,
T element)
Checks if the given element is the last in the given list.
|
static <T> java.util.List<T> |
rearrange(T element,
java.util.List<T> listToResort,
int rearrangeToIndex)
Rearrange the order from the given
List to the given rearranged index |
static <T> T |
removeFirst(java.util.List<T> list)
Removes the first object from the given List.
|
static <T> T |
removeLast(java.util.List<T> list)
Removes the last object from the given List.
|
static <T> java.util.List<T> |
removeLastValues(java.util.List<T> v,
int remove)
The Method removeLastValues(ArrayList, int) remove the last Values.
|
static <T> java.util.List<T> |
revertOrder(java.util.List<T> listToRevert)
Reverts the order from the given List.
|
static <T> void |
shuffle(java.util.List<T> source,
java.util.List<T> destination,
int[] selectedElements)
Shuffle selected elements in the source list to the destination list from the given indexes
in the array selectedElements.
|
static <T> void |
sortByProperty(java.util.List<T> list,
java.lang.String property,
boolean ascending)
Sort over the given property.
|
static <T> java.util.List<java.util.List<T>> |
splitToParts(java.util.Collection<T> collection,
int size)
Splits the given
Collection to parts to the specified size and returns a list with
the parts. |
static <T> T[] |
toArray(java.util.List<T> list)
To array.
|
static <T> T[] |
toArray(T... elements)
To array.
|
static <T> java.util.List<T> |
toList(java.util.Enumeration<T> enumaration)
Converts the given enumaration to a Vector.
|
static <T> java.util.List<T> |
toList(java.util.Set<T> set)
Converts the given
Set to a list. |
static <T> java.lang.Object[] |
toObjectArray(T... elements)
Converts the given parameter elements to an object array.
|
public static <T> boolean containAtleastOneObject(java.util.List<T> toSearch,
java.util.List<T> search)
T - the generic typetoSearch - The List to search.search - The List to inspect.public static java.util.List<java.util.List<java.lang.Integer>> getAllCombinations(java.util.List<java.lang.Integer> possibleNumbers,
int combinationSize)
Integer objectspossibleNumbers - the possible numberscombinationSize - the size of the combination to generateInteger objectspublic static <T> java.util.List<java.util.List<T>> getCombinations(java.util.List<T> possibleValues,
int combinationSize)
T - the generic type of the elements in the listcombinationSize - the size of the elements of the combinations to generatepossibleValues - the list with the element valuespublic static <T> T getFirst(java.util.List<T> list)
T - the generic typelist - the List.public static <T> T getLast(java.util.List<T> list)
T - the generic typelist - the List.public static <T> ModifiedCollections<T> getModifiedCollections(java.util.Collection<T> previous, java.util.Collection<T> next)
T - the generic typeprevious - the previous collection i.e. the collection from database.next - the next collection i.e. the current collection in the view.public static <T> java.util.List<T> getSameElementsFromLists(java.util.List<T> toSearch,
java.util.List<T> search)
T - the generic typetoSearch - The list to searchsearch - the list to inspectpublic static <T> boolean hasNext(java.util.List<T> list,
T element)
List has a next element from the given elementT - the generic typelist - the listelement - the elementpublic static <T> boolean hasPrevious(java.util.List<T> list,
T element)
List has a next element from the given elementT - the generic typelist - the listelement - the elementpublic static <T> boolean isEqualListOfArrays(java.util.List<T[]> one,
java.util.List<T[]> other)
Collection objects in equality.T - the generic type of the elementsone - the oneother - the otherCollection objects are equal otherwise falsepublic static <T> boolean isFirst(java.util.List<T> list,
T element)
T - the generic typelist - the listelement - the elementpublic static <T> boolean isLast(java.util.List<T> list,
T element)
T - the generic typelist - the listelement - the elementpublic static <T> java.util.List<T> rearrange(T element,
java.util.List<T> listToResort,
int rearrangeToIndex)
List to the given rearranged indexT - the generic type of the elementslistToResort - the list to resortelement - the element to rearrangerearrangeToIndex - the rearrange to indexListpublic static <T> T removeFirst(java.util.List<T> list)
T - the generic typelist - the List.public static <T> T removeLast(java.util.List<T> list)
T - the generic typelist - the List.public static <T> java.util.List<T> removeLastValues(java.util.List<T> v,
int remove)
T - the generic typev - The Vector with the received Messages.remove - How much to remove.public static <T> java.util.List<T> revertOrder(java.util.List<T> listToRevert)
T - the generic typelistToRevert - The List to revert.public static <T> void shuffle(java.util.List<T> source,
java.util.List<T> destination,
int[] selectedElements)
T - the generic typesource - the sourcedestination - the destinationselectedElements - the selected elementspublic static <T> void sortByProperty(java.util.List<T> list,
java.lang.String property,
boolean ascending)
T - the generic type of the listlist - the list to sort.property - the property to sort.ascending - if true the sort will be ascending ohterwise descending.public static <T> java.util.List<java.util.List<T>> splitToParts(java.util.Collection<T> collection,
int size)
Collection to parts to the specified size and returns a list with
the parts.T - the generic typecollection - The collection to splitsize - How to split.public static <T> T[] toArray(java.util.List<T> list)
T - the generic typelist - the list@SafeVarargs public static <T> T[] toArray(T... elements)
T - the generic typeelements - the elementspublic static <T> java.util.List<T> toList(java.util.Enumeration<T> enumaration)
T - the generic typeenumaration - The Enumeration to convert.public static <T> java.util.List<T> toList(java.util.Set<T> set)
Set to a list.T - the generic type of the elementsset - the set@SafeVarargs public static <T> java.lang.Object[] toObjectArray(T... elements)
T - the generic typeelements - The elements that will be in the returned object array