Skip to content

Commit

Permalink
feat(core): replace new ArrayList by Collections.emptyList()
Browse files Browse the repository at this point in the history
  • Loading branch information
loicmathieu committed Feb 28, 2025
1 parent 0d637c5 commit 2992172
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions core/src/main/java/io/kestra/core/models/flows/Flow.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ public Stream<String> allTypes() {

public Stream<Task> allTasks() {
return Stream.of(
this.tasks != null ? this.tasks : new ArrayList<Task>(),
this.errors != null ? this.errors : new ArrayList<Task>(),
this._finally != null ? this._finally : new ArrayList<Task>(),
this.tasks != null ? this.tasks : Collections.<Task>emptyList(),
this.errors != null ? this.errors : Collections.<Task>emptyList(),
this._finally != null ? this._finally : Collections.<Task>emptyList(),
this.listenersTasks()
)
.flatMap(Collection::stream);
Expand Down Expand Up @@ -331,7 +331,7 @@ private static Object recursiveUpdate(Object object, Task previous, Task newValu

private List<Task> listenersTasks() {
if (this.getListeners() == null) {
return new ArrayList<>();
return Collections.emptyList();
}

return this.getListeners()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected void updateGroupOffsets(DSLContext ctx, String consumerGroup, String q
DSL.field("CONCAT_WS(',', consumers, ?)", String.class, queueType)
)
.set(AbstractJdbcRepository.field("updated"), LocalDateTime.now())
.where(AbstractJdbcRepository.field("offset").in(offsets.toArray(Integer[]::new)));
.where(AbstractJdbcRepository.field("offset").in(offsets));

if (consumerGroup != null) {
update = update.and(AbstractJdbcRepository.field("consumer_group").eq(consumerGroup));
Expand Down

0 comments on commit 2992172

Please sign in to comment.