Android Utililty Methods Collection Element Get

List of utility methods to do Collection Element Get

Description

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

Method

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();
...
TgetFirst(Collection collection)
get First
if (collection.isEmpty())
    return null;
else
    return collection.iterator().next();
intgetLastIndex(final Collection collection)
Calculates the index of the last entry in the collection.
if (isEmpty(collection)) {
    return 0;
return collection.size() - 1;