List of utility methods to do Collection Element Get
Object[] | GetArrayFromCollection(java.util.Collection col) Get the contents of list as array if (col == null) { return null; Object[] arr = new Object[col.size()]; System.arraycopy(col.toArray(), 0, arr, 0, col.size()); return arr; |
Object[] | getArrays(Object parent, Collection collection) get Arrays if (collection.isEmpty()) { return EMPTY_ELEMENT_ARRAY; } else { return collection.toArray(); |
String | getAssociationCollectionObjectName(Collection currentObjectColl, Collection prevObjectColl) This method is called to obtain name of the object within the collection. String objectName = ""; if (currentObjectColl != null && !((Collection) currentObjectColl).isEmpty()) { objectName = (((Collection) currentObjectColl).iterator().next()).getClass().getName(); } else if (prevObjectColl != null && !((Collection) prevObjectColl).isEmpty()) { objectName = (((Collection) prevObjectColl).iterator().next()).getClass().getName(); return objectName; |
String | getAsString(Collection> data, char seperator) Returns a user specified string representation of a collection Iterator<?> it = data.iterator(); boolean first = true; StringBuffer ret = new StringBuffer(); while (it.hasNext()) { if (first == false) { ret.append(seperator); } else { first = false; ... |
String | getAsString(Collection get As String if (input == null || input.isEmpty()) { return EMPTY_STRING; return getUsString(input.toArray(new String[input.size()])); |
T | getAt(Collection get At if (col instanceof List) return ((List<T>) col).get(index); int i; Iterator<T> it; for (i = 0, it = col.iterator(); i < index && it.hasNext(); it.next()) ; return it.hasNext() ? it.next() : null; |
String | getAuthzNameFromEntityName(String entityName, Collection get Authz Name From Entity Name String result = null; if (entityName != null && entityName.contains("@")) { String lastPart = entityName.substring(entityName.lastIndexOf('@') + 1); result = authzProvidersNames.contains(lastPart) ? lastPart : null; return result; |
Object | getByIndex(Collection get By Index int i = 0; Iterator<Object> iterator = availableTransitions.iterator(); while (iterator.hasNext()) { Object transition = iterator.next(); if (i == index) { return transition; } else { ++i; ... |
T | getByIndex(Collection Gets collection value by index. assert idx < vals.size(); int i = 0; for (T val : vals) { if (idx == i) return val; i++; assert false : "Should never be reached."; ... |
List | getByMostFrequent(Collection Returns a list of unique elements by the most frequent. if (collection == null || collection.isEmpty()) { return null; final Map<T, Integer> histogram = getHistogram(collection); List<T> list = new ArrayList<T>(); list.addAll(histogram.keySet()); Collections.sort(list, new Comparator<T>() { @Override ... |