| 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 <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)
The Method looks at both List and if they have same objects they are added to one List and
will returns the result.
|
static <T> boolean |
isEmpty(List<T> list)
Checks if a List is null or empty.
|
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> boolean |
isNotEmpty(List<T> list)
Checks if the given List is not null or empty.
|
static <T> List<T> |
newArrayList(Collection<T> collection,
T... elements)
Factory method for create new
ArrayList from the given optional collection and the
given optional elements. |
static <T> List<T> |
newArrayList(int initialCapacity)
|
static <T> List<T> |
newArrayList(T... elements)
Factory method for create new
ArrayList from the given optional elements. |
static Integer[] |
newRangeArray(int start,
int end)
Creates a new
Integer array with the given range that is defined through start and
end. |
static List<Integer> |
newRangeList(int start,
int end)
|
static <T> void |
printCollection(Collection<T> collection)
Helper-Method for printing a Collection in the console.
|
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(ArrayList<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>> |
splitListToParts(List<T> list,
int times)
Splits the List to Parts to the specified times.
|
static <T> List<List<T>> |
splitSetToParts(Set<T> set,
int times)
Splits the Set to Parts to the specified times.
|
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... t)
Converts the given parameters to an object array.
|
static <T> Vector<T> |
toVector(Enumeration<T> enumaration)
Deprecated.
use instead VectorExtensions.toVector
|
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 search.search - The List to inspect.public static <T> boolean isEmpty(List<T> list)
T - the generic typelist - The List to check.public 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 isNotEmpty(List<T> list)
T - the generic typelist - The List to check.@SafeVarargs public static <T> List<T> newArrayList(Collection<T> collection, T... elements)
ArrayList from the given optional collection and the
given optional elements.public static <T> List<T> newArrayList(int initialCapacity)
@SafeVarargs public static <T> List<T> newArrayList(T... elements)
ArrayList from the given optional elements.public static Integer[] newRangeArray(int start, int end)
Integer array with the given range that is defined through start and
end. For instance if the start is 5 and the end is 9 the resulted array will be [5,6,7,8,9]start - The number to startend - The number to end minus oneInteger arraypublic static List<Integer> newRangeList(int start, int end)
Integer List with the given range that is defined through start
and end. For instance if the start is 5 and the end is 9 the resulted List will be
[5,6,7,8,9]start - The number to startend - The number to end minus oneInteger Listpublic static <T> void printCollection(Collection<T> collection)
T - the generic typecollection - The Collection to print.public 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(ArrayList<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>> splitListToParts(List<T> list, int times)
T - the generic typelist - The List to Splittimes - How to split.public static <T> List<List<T>> splitSetToParts(Set<T> set, int times)
T - the generic typeset - The Set to Splittimes - How to split.public 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... t)
T - the generic typet - The objects that will be in the returned object array@Deprecated public static <T> Vector<T> toVector(Enumeration<T> enumaration)
T - the generic typeenumaration - The Enumeration to convert.Copyright © 2015–2017 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.