public class OkkamLists extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> boolean |
addIfEquals(List<T> list,
T elemToAdd,
T elemToCompare)
Add elemToAdd to the list only if it is equals to elemToCompare.
|
static <T,T1> boolean |
addIfEquals(List<T> list,
T elemToAdd,
T1 element1,
T1 element2)
Add elemToAdd to the list only if element1 is equals to element2.
|
static <T> List<T> |
addIfNotContained(List<T> list,
T... elements)
add elements if not already contained.
|
static <T> List<T> |
appendElements(List<T> list,
T... elements)
Append elements to a list.
|
static <T> List<T> |
createArrayListIfNull(List<T> list)
Create an ArrayList if the List is null.
|
static <T> List<T> |
prependElements(List<T> list,
T... elements)
Prepend elements to a list.
|
@SafeVarargs public static <T> List<T> appendElements(List<T> list, T... elements)
T - The list and elements typelist - The listelements - The elements to append@SafeVarargs public static <T> List<T> prependElements(List<T> list, T... elements)
T - The list and elements typelist - The listelements - The elements to prepend@SafeVarargs public static <T> List<T> addIfNotContained(List<T> list, T... elements)
T - The list and elements typelist - The listelements - The elements to addpublic static <T> boolean addIfEquals(List<T> list, T elemToAdd, T elemToCompare)
T - The list and elements typelist - The listelemToAdd - The element to addelemToCompare - The second elementpublic static <T,T1> boolean addIfEquals(List<T> list, T elemToAdd, T1 element1, T1 element2)
T - The list and elements typeT1 - The type of elements to checklist - The listelemToAdd - The element to addelement1 - The first elementelement2 - The second elementCopyright © 2018 Okkam srl. All rights reserved.