list 转map(1对1)
list 转 map(value是list)
List<CityRideDraftDto> channelCityRideDraftDtoList = channelCityRideDraftDtoListMap.computeIfAbsent(cityRideDraftDto.getChannel(), k -> new ArrayList<>());
List.new一个:
package com.google.common.collect.Lists;
List<String> keyList = Lists.newArrayList(partnerServerInfo.getAndroidDriverKey(),
partnerServerInfo.getAndroidPassengerKey(),
partnerServerInfo.getIosDriverKey(),
partnerServerInfo.getIosPassengerKey());
当前时间:
import org.joda.time.LocalDateTime;
LocalDateTime.now().toDate();
善用Optional:
JSONObject extJson = Optional.ofNullable(JSONObject.parseObject(approvalLog.getExt())).orElse(new JSONObject());
重试注解:
@Retryable(value = {HttpRequestApiException.class}, maxAttempts = 3,
backoff = @Backoff(delay = 1000L, multiplier = 1.5))
判空:
字符串:org.apache.commons.lang3.StringUtils isBlank()
对象:if (Objects.nonNull(merchantBusinessType)) {}
集合:import org.apache.commons.collections.CollectionUtils;
CollectionUtils.isNotEmpty(list)
不符合要求抛异常:
Assert.notNull(processInstanceOpenApi, "processInstanceOpenApi is empty");