Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH under
* one or more contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright ownership.
* Licensed under the Camunda License 1.0. You may not use this file
* except in compliance with the Camunda License 1.0.
*/
package io.camunda.operate.util;
import static io.camunda.operate.util.ConversionUtils.STRING_TO_LONG;
import io.camunda.operate.exceptions.OperateRuntimeException;
import java.util.AbstractList;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public abstract class CollectionUtil {
public static V getOrDefaultForNullValue(Map map, K key, V defaultValue) {
final V value = map.get(key);
return value == null ? defaultValue : value;
}
public static T getOrDefaultFromMap(Map map, K key, T defaultValue) {
return key == null ? defaultValue : map.getOrDefault(key, defaultValue);
}
public static T firstOrDefault(List list, T defaultValue) {
return list.isEmpty() ? defaultValue : list.get(0);
}
@SafeVarargs
public static List throwAwayNullElements(T... array) {
final List listOfNotNulls = new ArrayList<>();
for (T o : array) {
if (o != null) {
listOfNotNulls.add(o);
}
}
return listOfNotNulls;
}
public static Predicate distinctByKey(Function super T, ?> keyExtractor) {
final Set