List of utility methods to do Collection Element Get
String | getCommonSuffix(Collection get Common Suffix if (c.size() == 0) { return ""; Iterator<String> iterator = c.iterator(); String commonSuffix = iterator.next(); while (iterator.hasNext()) { commonSuffix = getCommonSuffix(commonSuffix, iterator.next()); return commonSuffix; |
String | getComponentName(Collection Create a unique name for an unnamed component if (existingNames.contains(name)) { int n = 2; while (existingNames.contains(name + " (" + n + ")")) { n++; return name + " (" + n + ")"; } else { return name; ... |
String | getDocIdString(Collection Decodes the encoded document IDs and returns the comma-separated String of quoted document IDs. StringBuilder docIdString = new StringBuilder(""); for (String docId : docIds) { docIdString.append("'" + docId + "'" + ","); return docIdString.substring(0, docIdString.length() - 1); |
T | getElement(final int index, final Collection makes sense only if iteration order deterministic! return getElement(false, index, coll);
|
Class | getElementClass(Collection get Element Class final E nonNull = firstNonNull(collection); return nonNull == null ? null : (Class<E>) nonNull.getClass(); |
T | getElementFromSize1(Collection get Element From Size isNotSize1Exception(collection);
return getSingleElement(collection);
|
double | getEntropy(Collection get Entropy if (values.isEmpty()) { return -1.0; double noOfTerms = 0; for (Double frequency : values) { noOfTerms += frequency; double entropy = 0.0; ... |
List | getEnumNames(Collection extends Enum> values) Extracts the names of the given enum elements and returns them as string. final List<String> result = new ArrayList<String>(values.size()); for (final Enum value : values) { result.add(value.name()); return result; |
String | getFlatString(Collection extends Object> elements) get Flat String return getFlatString(",", false, elements.toArray()); |
Object | getGivenClassObject(Collection coll, Class clazz) Get the given class type object from the collection. for (Iterator iterator = coll.iterator(); iterator.hasNext();) { Object object = (Object) iterator.next(); if (object != null && clazz.isAssignableFrom(object.getClass())) { return object; return null; |