public class ListUtils extends Object
| Constructor and Description |
|---|
ListUtils() |
| 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 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> 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> Object[] |
toObjectArray(T... t)
Converts the given parameters 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 search.search - The List to inspect.public static <T> boolean isEmpty(List<T> list)
T - the generic typelist - The List to check.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 arrayIllegalArgumentException - when start greater than end.public 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 ListIllegalArgumentException - when start greater than end.public 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> 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.@SafeVarargs public static <T> Object[] toObjectArray(T... t)
T - the generic typet - The objects that will be in the returned object arrayCopyright © 2007–2015 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.