|
JAPI 0.9.0 Yet another Java API API Documentation |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.japi.util.Collections2
public class Collections2
This class provides some additional utility methods you might miss in Collections
.
It is named Collections2 so you have no problems using both, this class and java.util.Collections
(no name conflict).
Collections
Method Summary | ||
---|---|---|
static
|
filter(C c,
Filter<? super T> filter)
Returns a collection only containing those elements accepted by the given filter. |
|
static
|
isSorted(List<T> list)
Checks whether a list is sorted. |
|
static
|
isSorted(List<T> list,
Comparator<? super T> c)
Checks whether a list is sorted. |
|
static
|
removeFilter(C collection,
Filter<? super T> filter)
Removes all elements from a collection not accepted by the given filter. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static final <T,C extends Collection<T>> C filter(C c, Filter<? super T> filter)
Object.clone()
c using Reflection and Collection.clear()
the cloneRandomAccess
List
, in which case an ArrayList
is returned as an alternative
c
- Collection to filterfilter
- Filter to use for c
null
if the Collection could not be created.public static final <T,C extends Collection<T>> int removeFilter(C collection, Filter<? super T> filter)
collection
- Collection to filterfilter
- Filter to use for c
public static final <T extends Comparable<? super T>> boolean isSorted(List<T> list)
list
- List to check
true
if list is sorted, otherwise false
Comparable
,
Collections.sort(List)
public static final <T> boolean isSorted(List<T> list, Comparator<? super T> c)
list
- List to checkc
- Comparator to use for comparing list elements
true
if list is sorted, otherwise false
Comparator
,
Collections.sort(List,Comparator)
|
JAPI Yet another Java API API Documentation |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |