| Constructor and Description |
|---|
ListExtensions() |
| Modifier and Type | Method and Description |
|---|---|
static <T> boolean |
containAtleastOneObject(List<T> toSearch,
List<T> search)
This Method look in the List toSearch if at least one Object exists in the List search.
|
static List<List<Integer>> |
getAllCombinations(@NonNull List<Integer> possibleNumbers,
int combinationSize)
Gets all possible combinations from the given list of
Integer objects |
static <T> List<List<T>> |
getCombinations(@NonNull List<T> possibleValues,
int combinationSize)
Gets all possible combinations from the given list
|
static <T> T |
getFirst(List<T> list)
Gets the first object from the given List.
|
static <T> T |
getLast(List<T> list)
Gets the last object from the given List.
|
static <T> ModifiedCollections<T> |
getModifiedCollections(Collection<T> previous,
Collection<T> next)
Gets the modified lists. finding from an old list which elements have been removed and which
have been added.
|
static <T> List<T> |
getSameElementsFromLists(List<T> toSearch,
List<T> search)
This method decorates the retainAll method and returns the result in a new list
|
static <T> boolean |
hasNext(@NonNull List<T> list,
T element)
Checks if the given
List has a next element from the given element |
static <T> boolean |
hasPrevious(@NonNull List<T> list,
T element)
Checks if the given
List has a next element from the given element |
static <T> boolean |
isEqualListOfArrays(List<T[]> one,
List<T[]> other)
Compare the given two
Collection objects in equality. |
static <T> boolean |
isFirst(List<T> list,
T element)
Checks if the given element is the first in the given list.
|
static <T> boolean |
isLast(List<T> list,
T element)
Checks if the given element is the last in the given list.
|
static <T> List<T> |
rearrange(T element,
@NonNull List<T> listToResort,
int rearrangeToIndex)
Rearrange the order from the given
List to the given rearranged index |
static <T> T |
removeFirst(List<T> list)
Removes the first object from the given List.
|
static <T> T |
removeLast(List<T> list)
Removes the last object from the given List.
|
static <T> List<T> |
removeLastValues(List<T> v,
int remove)
The Method removeLastValues(ArrayList, int) remove the last Values.
|
static <T> List<T> |
revertOrder(List<T> listToRevert)
Reverts the order from the given List.
|
static <T> void |
shuffle(List<T> source,
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(List<T> list,
String property,
boolean ascending)
Sort over the given property.
|
static <T> List<List<T>> |
splitToParts(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(@NonNull List<T> list)
To array.
|
static <T> T[] |
toArray(T... elements)
To array.
|
static <T> List<T> |
toList(Enumeration<T> enumaration)
Converts the given enumaration to a Vector.
|
static <T> List<T> |
toList(Set<T> set)
Converts the given
Set to a list. |
static <T> Object[] |
toObjectArray(T... elements)
Converts the given parameter elements to an object array.
|
public static <T> boolean containAtleastOneObject(List<T> toSearch, List<T> search)
T - the generic typetoSearch - The List to search.search - The List to inspect.public static <T> T getFirst(List<T> list)
T - the generic typelist - the List.public static <T> T getLast(List<T> list)
T - the generic typelist - the List.public static <T> ModifiedCollections<T> getModifiedCollections(Collection<T> previous, 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> List<T> getSameElementsFromLists(List<T> toSearch, List<T> search)
T - the generic typetoSearch - The list to searchsearch - the list to inspectpublic static <T> boolean isEqualListOfArrays(List<T[]> one, 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(List<T> list, T element)
T - the generic typelist - the listelement - the elementpublic static <T> boolean isLast(List<T> list, T element)
T - the generic typelist - the listelement - the elementpublic static <T> boolean hasNext(@NonNull
@NonNull 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(@NonNull
@NonNull List<T> list,
T element)
List has a next element from the given elementT - the generic typelist - the listelement - the elementpublic static <T> List<T> rearrange(@NonNull T element, @NonNull @NonNull 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(List<T> list)
T - the generic typelist - the List.public static <T> T removeLast(List<T> list)
T - the generic typelist - the List.public static <T> List<T> removeLastValues(List<T> v, int remove)
T - the generic typev - The Vector with the received Messages.remove - How much to remove.public static <T> List<T> revertOrder(List<T> listToRevert)
T - the generic typelistToRevert - The List to revert.public static <T> void shuffle(List<T> source, List<T> destination, int[] selectedElements)
T - the generic typesource - the sourcedestination - the destinationselectedElements - the selected elementspublic static <T> void sortByProperty(List<T> list, 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> List<List<T>> splitToParts(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.@SafeVarargs public static <T> T[] toArray(T... elements)
T - the generic typeelements - the elementspublic static <T> T[] toArray(@NonNull
@NonNull List<T> list)
T - the generic typelist - the listpublic static <T> List<T> toList(Enumeration<T> enumaration)
T - the generic typeenumaration - The Enumeration to convert.public static <T> List<T> toList(Set<T> set)
Set to a list.T - the generic type of the elementsset - the set@SafeVarargs public static <T> Object[] toObjectArray(T... elements)
T - the generic typeelements - The elements that will be in the returned object arraypublic static List<List<Integer>> getAllCombinations(@NonNull @NonNull List<Integer> possibleNumbers, int combinationSize)
Integer objectspossibleNumbers - the possible numberscombinationSize - the size of the combination to generateInteger objectspublic static <T> List<List<T>> getCombinations(@NonNull @NonNull 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 valuesCopyright © 2015–2019 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.