Java Utililty Methods List Range

List of utility methods to do List Range

  1. HOME
  2. Java
  3. L
  4. List Range

Description

The list of methods to do List Range are organized into topic(s).

Method

double getRange(List numbers)
Returns the difference between the maximum and the minimum of a list of Doubles.

return getMax(numbers) - getMin(numbers);
List getRange(List list, int start)
Gets all elements from a list starting from the given index.
if (start >= list.size()) {
 return new ArrayList<>();
return list.subList(start, list.size());
List getRange(List list, int start, int count)
Get a range from a list based on start and count parameters in a safe way.
if (start >= list.size() || count <= 0) {
 return new ArrayList<>();
} else if (start < 0) {
 start = 0;
int end = Math.min(list.size(), start + count);
return list.subList(start, end);

AltStyle によって変換されたページ (->オリジナル) /