Java Utililty Methods Collection Find

List of utility methods to do Collection Find

Description

The list of methods to do Collection Find are organized into topic(s).

Method

ClassfindClass(String name, Collection availableImports, ClassLoader cl)
find Class
Class<?> clazz = null;
for (String imp : availableImports) {
    if (imp.endsWith(".*")) {
        imp = imp.substring(0, imp.length() - 2);
    String className = imp.endsWith(name) ? imp : imp + "." + name;
    clazz = findClass(className, cl);
    if (clazz != null) {
...
ClassfindCommonElementType(Collection collection)
find Common Element Type
if (isEmpty(collection)) {
    return null;
} else {
    Class candidate = null;
    Iterator i$ = collection.iterator();
    while (i$.hasNext()) {
        Object val = i$.next();
        if (val != null) {
...
ClassfindCommonElementType(Collection collection)
find Common Element Type
if (isEmpty(collection)) {
    return null;
Class<?> candidate = null;
for (Object val : collection) {
    if (val != null) {
        if (candidate == null) {
            candidate = val.getClass();
...
ClassfindCommonElementType(Collection collection)
Find the common element type of the given Collection, if any.
if (isEmpty(collection)) {
    return null;
Class<?> candidate = null;
for (Object val : collection) {
    if (val != null) {
        if (candidate == null) {
            candidate = val.getClass();
...
ClassfindCommonElementType(Collection collection)
find Common Element Type
if (isEmpty(collection)) {
    return null;
Class<?> candidate = null;
for (Object val : collection) {
    if (val != null) {
        if (candidate == null) {
            candidate = val.getClass();
...
doublefindMax(Collection vals)
find Max
double max = Double.MIN_VALUE;
for (double d : vals) {
    if (d > max)
        max = d;
return max;
doublefindMax(Collection vals)
find Max
double max = Double.MIN_VALUE;
for (double d : vals) {
    if (d > max)
        max = d;
return max;
TfindMax(Iterable collection)
find Max
T max = null;
Iterator<T> it = collection.iterator();
while (it.hasNext()) {
    T obj = it.next();
    if (null == max || max.compareTo(obj) < 0) {
        max = obj;
return max;
TfindValueOfType(Collection collection, Class type)
Find a single value of the given type in the given Collection.
if (isEmpty(collection)) {
    return null;
T value = null;
for (Object element : collection) {
    if (type == null || type.isInstance(element)) {
        if (value != null) {
            return null;
...
TfindValueOfType(Collection collection, Class type)
Find a single value of the given type in the given Collection.
if (isEmpty(collection)) {
    return null;
T value = null;
for (Object element : collection) {
    if (type == null || type.isInstance(element)) {
        if (value != null) {
            return null;
...