}
public PermissionQuery build() {
- this.organizationUuid = requireNonNull(organizationUuid, "Organization UUID cannot be null");
+ requireNonNull(organizationUuid, "Organization UUID cannot be null");
this.pageIndex = firstNonNull(pageIndex, DEFAULT_PAGE_INDEX);
this.pageSize = firstNonNull(pageSize, DEFAULT_PAGE_SIZE);
checkArgument(searchQuery == null || searchQuery.length() >= SEARCH_QUERY_MIN_LENGTH, "Search query should contains at least %s characters", SEARCH_QUERY_MIN_LENGTH);
ComponentDto componentDto = duplication.file();
if (componentDto != null) {
String componentKey = componentDto.getDbKey();
- ref = refByComponentKey.get(componentKey);
- if (ref == null) {
- ref = Integer.toString(refByComponentKey.size() + 1);
- refByComponentKey.put(componentKey, ref);
- }
+ ref = refByComponentKey.computeIfAbsent(componentKey, k -> Integer.toString(refByComponentKey.size() + 1));
}
Block.Builder block = Block.newBuilder();
.offset(offsetInSeconds + "s")
// ES dateHistogram bounds are inclusive while createdBefore parameter is exclusive
.extendedBounds(new ExtendedBounds(startTime, endTime - (offsetInSeconds*1_000L) -1L));
- dateHistogram = addEffortAggregationIfNeeded(query, dateHistogram);
+ addEffortAggregationIfNeeded(query, dateHistogram);
return Optional.of(dateHistogram);
}
}
private Stats getOrCreate(String assignee) {
- if (assigneesStatistics.get(assignee) == null) {
- assigneesStatistics.put(assignee, new Stats());
- }
- return assigneesStatistics.get(assignee);
+ return assigneesStatistics.computeIfAbsent(assignee, a -> new Stats());
}
public Map<String, Stats> assigneesStatistics() {