|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.util.Sets
public class Sets
utility class for calculations on sets, lists and other collections.
| Method Summary | ||
|---|---|---|
static
|
asList(Collection<T> col)
convenience method to display a collection in a JList for example |
|
static
|
difference(Set<? extends T> set1,
Set<? extends T> set2)
returns a set that contains all elements from set1 that are not in set2 |
|
static
|
extract(Collection<T> col,
Filter<T> filter)
returns a new Collection that will only contain those elements that passed the filter. |
|
static
|
filter(Collection<T> col,
Filter<T> filter)
filters all objects out of the given col that are not accepted by the filter; the dropout is returned as a separate Collection. |
|
static
|
groupBy(Collection<T> col,
PatternExtractor<T,P> extractor)
splits the given collection into many, where the extractor is the discriminator |
|
static
|
keyForValue(Map<K,V> map,
V value)
|
|
static
|
keysForValue(Map<K,V> map,
V value)
|
|
static
|
makeSet(T[] array)
|
|
static
|
makeSet(T[] array,
boolean ignoreDuplicates)
|
|
static
|
reverseMap(Map<K,V> map)
generates a reversed map, mapping values to keys |
|
static boolean |
same(Map m1,
Map m2)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static <T> List<T> asList(Collection<T> col)
public static <T> ArrayList<T> filter(Collection<T> col,
Filter<T> filter)
public static <T> ArrayList<T> extract(Collection<T> col,
Filter<T> filter)
public static <T,P> HashMap<P,ArrayList<T>> groupBy(Collection<T> col,
PatternExtractor<T,P> extractor)
public static <T> HashSet<T> makeSet(T[] array)
throws IllegalArgumentException
IllegalArgumentException - if the array contains duplicatespublic static <K,V> Map<V,K> reverseMap(Map<K,V> map)
public static <K,V> K keyForValue(Map<K,V> map,
V value)
public static <K,V> Set<K> keysForValue(Map<K,V> map,
V value)
public static <T> HashSet<T> makeSet(T[] array,
boolean ignoreDuplicates)
throws IllegalArgumentException
IllegalArgumentException - if the array contains duplicates and ignoreduplicates is false
public static <T> Set<? extends T> difference(Set<? extends T> set1,
Set<? extends T> set2)
public static boolean same(Map m1,
Map m2)
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||