public final class CollectionUtils
extends java.lang.Object
Various helper methods for working with collections (particularly Fastutil collections).
Modifier and Type | Method and Description |
---|---|
static IntList |
interval(int from,
int to)
Create an
IntList that contains all numbers in a specified interval. |
static <E> ObjectCollection<E> |
objectCollection(java.util.Collection<E> objects)
Wrap a
Collection in an ObjectCollection . |
static <T> java.util.List<T> |
repeat(T obj,
int n)
Return a list that repeats a single object multiple times.
|
public static <E> ObjectCollection<E> objectCollection(java.util.Collection<E> objects)
Wrap a Collection
in an ObjectCollection
.
objects
- The collection of objects.E
- The type of objects.ObjectCollection
.public static <T> java.util.List<T> repeat(T obj, int n)
Return a list that repeats a single object multiple times.
obj
- The object.n
- The size of the list.T
- The type of list elements.