java.lang.Object
de.agilecoders.wicket.jquery.util.Generics2
helper class to handle creation/transformation/filtering of collections.
This class is used to wrap guava. Future releases of bootstrap won't depend
on guava anymore.
- Author:
- miha
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> List<T>Returns the elements ofunfilteredthat satisfy givenfilter.static Stringjoins all given elements with a special separatorstatic <T> ArrayList<T>newArrayList(Iterable<? extends T> elements) creates a newArrayListfrom given array of elements.static <T> ArrayList<T>newArrayList(Iterator<? extends T> elements) Creates a mutableArrayListinstance containing the given elements.static <T> ArrayList<T>newArrayList(T... elements) creates a newArrayListfrom given array of elements.static <T> Set<T>newHashSet(T... elements) creates a newHashSetfrom given array of elements.static <T> Set<T>newLinkedHashSet(Iterable<? extends T> elements) creates a newLinkedHashSetfrom given array of elements.split(CharSequence value, String separator) splits aCharSequenceby given separator.static <P,R> List<R> Returns a list that appliestransformerto each element ofelementsstatic <P,R> Set<R> Returns a list that appliestransformerto each element ofelementsstatic <P,R> List<R> Returns a list that appliestransformerto each element ofelementsstatic <T> List<T>transform(T[] elements) transform an array of elements into a list of elements
-
Method Details
-
newArrayList
creates a newArrayListfrom given array of elements.- Type Parameters:
T- the type of all elements inside the list- Parameters:
elements- the elements to add to newArrayList- Returns:
- new
ArrayListthat contains all given elements - Throws:
IllegalArgumentException- if given array of elements is null
-
newArrayList
Creates a mutableArrayListinstance containing the given elements.- Parameters:
elements- the elements that the list should contain, in order- Returns:
- a new
ArrayListcontaining those elements
-
newArrayList
creates a newArrayListfrom given array of elements.- Type Parameters:
T- the type of all elements inside the list- Parameters:
elements- the elements to add to newArrayList- Returns:
- new
ArrayListthat contains all given elements - Throws:
IllegalArgumentException- if given array of elements is null
-
newLinkedHashSet
creates a newLinkedHashSetfrom given array of elements.- Type Parameters:
T- the type of all elements inside the set- Parameters:
elements- the elements to add to newLinkedHashSet- Returns:
- new
LinkedHashSetthat contains all given elements - Throws:
IllegalArgumentException- if given array of elements is null
-
newHashSet
creates a newHashSetfrom given array of elements.- Type Parameters:
T- the type of all elements inside the set- Parameters:
elements- the elements to add to newHashSet- Returns:
- new
HashSetthat contains all given elements - Throws:
IllegalArgumentException- if given array of elements is null
-
join
joins all given elements with a special separator- Parameters:
elements- elements to joinseparator- separator to use- Returns:
- elements as string
-
transform
transform an array of elements into a list of elements- Type Parameters:
T- the type of elements- Parameters:
elements- the elements to add to list- Returns:
- new list of elements
-
transform
Returns a list that appliestransformerto each element ofelements -
transform
Returns a list that appliestransformerto each element ofelements -
transform
Returns a list that appliestransformerto each element ofelements -
filter
Returns the elements ofunfilteredthat satisfy givenfilter. The resulting iterable's iterator does not supportremove(). -
split
splits aCharSequenceby given separator.- Parameters:
value- the value to splitseparator- the separator to use to split value- Returns:
- list of values
-