Extracts features from a {@link FeatureCollection} into an {@link ArrayList}.

@param collection the feature collection.
@return the list with the features or an empty list if no features present.
163783
public static List<SimpleFeature> featureCollectionToList( SimpleFeatureCollection collection ) {
        List<SimpleFeature> featuresList = new ArrayList<SimpleFeature>();
        if (collection == null) {
            return featuresList;
        }
        SimpleFeatureIterator featureIterator = collection.features();
        while( featureIterator.hasNext() ) {
            SimpleFeature feature = featureIterator.next();
            featuresList.add(feature);
        }
        featureIterator.close();
        return featuresList;
    }
285438
public static List<Object> extract(Iterable<?> collection, Editor<Object> editor) {
		return extract(collection, editor, false);
	}
269865
protected <T> List<? extends List<T>> toArrayLists(List<List<T>> lists) {
        for (int i = 0; i < lists.size(); i++) {
            List<T> list = lists.get(i);
            lists.set(i, toArrayList(list));
        }
        return lists;
    }
1094977
public static <T> Set<T> toSet(final Collection<T> collection) {

        if (isEmpty(collection)) {
            return new HashSet<T>(0);
        } else {
            return new HashSet<T>(collection);
        }
    }
540653
@Override
	public <E> String serializeCollection(Collection<E> collection, Class<E> objectClazz) {
		if (collection == null)
			return null;

		SegmentedStringWriter source = new SegmentedStringWriter(buffer.get());
		try (SerializerWrapper serializer = createSerializer(source)) {
			mapperFor(objectClazz).serializeCollection(this, serializer, collection);
		} catch (Exception e) {
			e.printStackTrace();
			throw new KriptonRuntimeException(e);
		}
		return source.getAndClear();
	}
1359220
@SuppressWarnings("unchecked")
    @Override
    public Collection<FeatureCollectionAsset> getFeatureCollections(String productId, String productVersion, String productInstallType, String productLicenseType,
                                                                    String productEdition) {
        return (Collection<FeatureCollectionAsset>) getEsaAsset(productId, productVersion, productInstallType, productLicenseType, productEdition,
                                                                Visibility.INSTALL);
    }
17241
public Geometry toGeometry(final FeatureCollection featureCollection) {
        if (featureCollection == null) {
            return null;
        }
        final Geometry geometry = new Geometry();
        final Feature location =
                populateBoundaries(geometry, featureCollection);
        populateLocation(geometry, location);
        return geometry;
    }
329128
public static <T> List<List<T>> split(Collection<T> collection, int size) {
		final List<List<T>> result = new ArrayList<>();

		ArrayList<T> subList = new ArrayList<>(size);
		for (T t : collection) {
			if (subList.size() >= size) {
				result.add(subList);
				subList = new ArrayList<>(size);
			}
			subList.add(t);
		}
		result.add(subList);
		return result;
	}
1310470
public static String getFeatureListOutput(Collection<String> featureList) {
        StringBuffer sb = new StringBuffer();
        for (String output : featureList)
            sb.append(output + " ");
        return sb.toString().trim();
    }
512165
public static List<Object> getFieldValues(Iterable<?> collection, final String fieldName) {
		return getFieldValues(collection, fieldName, false);
	}
496932
public static<T> Collection<T> sortByUpdateDate(Collection<T> collection)
   {

       List<T> list = collection instanceof List ? (List<T>) collection : new ArrayList<T>(collection); 

      Collections.sort(list, new UpdateDateComparator());

      return list;

   }
550711
public static <T> Set<T> getSet(Collection<T> collection) {
    Set<T> set = new LinkedHashSet<T>();
    set.addAll(collection);

    return set;
  }
926613
public static Object getElementFromCollection(Collection<Object> collection, int index) {
    if (collection.size() < index + 1)
      return null;

    if (collection instanceof List)
      return ((List<Object>) collection).get(index);

    Iterator<Object> iterator = collection.iterator();
    for (int i = 0; i < index; i++) {
      iterator.next();
    }
    return iterator.next();
  }
553596
private void processClassDescriptorCollection(final Object classDescriptorCollection) {
        if (classDescriptorCollection == null || !isCastable("java.util.Collection", classDescriptorCollection.getClass())) {
            return;
        }

        final Collection<?> c = (Collection<?>) classDescriptorCollection;
        for (Object descriptor : c) {
            processClassDescriptorObject(descriptor);
        }
    }
899260
@SuppressWarnings({
			"unchecked", "rawtypes"
	})
	public Collection<String> getStringCollection(final Class<? extends Collection> clazz) {
		try {
			final Collection<String> collection = clazz.newInstance();
			final int len = getVInt();
			for (int i = 0; i < len; i++) {
				collection.add(getString());
			}
			return collection;
		} catch (InstantiationException e) {
			throw new IllegalArgumentException("Invalid class", e);
		} catch (IllegalAccessException e) {
			throw new IllegalArgumentException("Invalid class", e);
		}
	}
1200784
public static function toList($collection) {
		$list = new ArrayList();
		foreach ($collection as $v) {
			$list->add(self::toCollection($v));
		}
		return $list;
	}
1072621
public static <T, J extends Convertable<T>> ArrayList<T> convert(Collection<J> collection) {
        if (collection == null) {
            return null;
        }

        ArrayList<T> list = new ArrayList<>(collection.size());

        for (J json : collection) {
            try {
                T item = json == null ? null : json.convert();
                if (item != null) {
                    list.add(item);
                }
            } catch (ParseException e) {
                Log.e("ConvertUtils", "Error converting item (" + json.getClass().getSimpleName()
                        + ") : " + e.getMessage());
            }
        }

        return list;
    }