Package io.sentry.util
Class CollectionUtils
- java.lang.Object
-
- io.sentry.util.CollectionUtils
-
@Internal public final class CollectionUtils extends java.lang.Object
Util class for Collections
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
CollectionUtils.Predicate<T>
A simplified copy of Java 8 Predicate.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <K,V>
@NotNull java.util.Map<K,V>filterMapEntries(@NotNull java.util.Map<K,V> map, @NotNull CollectionUtils.Predicate<java.util.Map.Entry<K,V>> predicate)
Returns a new map which entries match a predicate specified by a parameter.static <T> @Nullable java.util.List<T>
newArrayList(@Nullable java.util.List<T> list)
Creates a newArrayList
as a shallow copy of list given by parameter.static <K,V>
@Nullable java.util.Map<K,@NotNull V>newConcurrentHashMap(@Nullable java.util.Map<K,@NotNull V> map)
Creates a newConcurrentHashMap
as a shallow copy of map given by parameter.static <K,V>
@Nullable java.util.Map<K,@NotNull V>newHashMap(@Nullable java.util.Map<K,@NotNull V> map)
Creates a newHashMap
as a shallow copy of map given by parameter.static int
size(@NotNull java.lang.Iterable<?> data)
Returns an Iterator size
-
-
-
Method Detail
-
size
public static int size(@NotNull @NotNull java.lang.Iterable<?> data)
Returns an Iterator size- Parameters:
data
- the Iterable- Returns:
- iterator size
-
newConcurrentHashMap
@Nullable public static <K,V> @Nullable java.util.Map<K,@NotNull V> newConcurrentHashMap(@Nullable @Nullable java.util.Map<K,@NotNull V> map)
Creates a newConcurrentHashMap
as a shallow copy of map given by parameter.- Type Parameters:
K
- the type of map keysV
- the type of map values- Parameters:
map
- the map to copy- Returns:
- the shallow copy of map
-
newHashMap
@Nullable public static <K,V> @Nullable java.util.Map<K,@NotNull V> newHashMap(@Nullable @Nullable java.util.Map<K,@NotNull V> map)
Creates a newHashMap
as a shallow copy of map given by parameter.- Type Parameters:
K
- the type of map keysV
- the type of map values- Parameters:
map
- the map to copy- Returns:
- a new
HashMap
ornull
if parameter isnull
-
newArrayList
@Nullable public static <T> @Nullable java.util.List<T> newArrayList(@Nullable @Nullable java.util.List<T> list)
Creates a newArrayList
as a shallow copy of list given by parameter.- Type Parameters:
T
- the type of list entries- Parameters:
list
- the list to copy- Returns:
- a new
ArrayList
ornull
if parameter isnull
-
filterMapEntries
@NotNull public static <K,V> @NotNull java.util.Map<K,V> filterMapEntries(@NotNull @NotNull java.util.Map<K,V> map, @NotNull @NotNull CollectionUtils.Predicate<java.util.Map.Entry<K,V>> predicate)
Returns a new map which entries match a predicate specified by a parameter.- Type Parameters:
K
- - map entry key typeV
- - map entry value type- Parameters:
map
- - the map to filterpredicate
- - the predicate- Returns:
- a new map
-
-