com.levigo.util.base.collections
Class Collections
java.lang.Object
com.levigo.util.base.collections.Collections
public class Collections
- extends Object
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
clusterize
public static <C> List<List<C>> clusterize(List<C> elements,
Comparator<C> comp)
- A very simple clusterizer which traverses the given elements in order. The first element
becomes the nucleus of a new cluster. The following elements are clustered with the nucleus as
long as the given comparator signals equality of the given element and the nucleus as per
Comparator.compare(Object, Object)
. Otherwise a new cluster is started.
- Parameters:
elements
- the elements to clustercomp
- the comparator used to compare nucleus and element
- Returns:
- a list of clusters
flatten
public static <E> List<E> flatten(Collection<? extends Collection<E>> src)
flatten
public static <E> void flatten(Collection<? extends Collection<E>> src,
Collection<E> dst)
Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.