Skip to content

Commit

Permalink
Replace 'Arrays.asList' for single element lists
Browse files Browse the repository at this point in the history
  • Loading branch information
solth committed Jan 29, 2025
1 parent 8f9d1fc commit da6394b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import java.io.OutputStream;
import java.io.UncheckedIOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
Expand Down Expand Up @@ -90,7 +89,7 @@ public class ExportXmlLog implements Consumer<OutputStream> {
* docket data
*/
ExportXmlLog(DocketData docketData) {
this.docketData = Arrays.asList(docketData);
this.docketData = Collections.singletonList(docketData);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ public List<LegacyMetadataHelper> getAllMetadata() {
public List<LegacyMetadataHelper> getAllMetadataByType(LegacyMetadataTypeHelper metadataType) {
if (metadataType == LegacyMetadataTypeHelper.SPECIAL_TYPE_ORDER) {
return Objects.nonNull(physicalDivision)
? Arrays.asList(
new LegacyMetadataHelper(this, metadataType, Integer.toString(physicalDivision.getOrder())))
? List.of(
new LegacyMetadataHelper(this, metadataType, Integer.toString(physicalDivision.getOrder())))
: Collections.emptyList();
} else if (metadataType == LegacyMetadataTypeHelper.SPECIAL_TYPE_ORDERLABEL) {
return Objects.nonNull(physicalDivision) && Objects.nonNull(physicalDivision.getOrderlabel())
? Arrays.asList(new LegacyMetadataHelper(this, metadataType, physicalDivision.getOrderlabel()))
? List.of(new LegacyMetadataHelper(this, metadataType, physicalDivision.getOrderlabel()))
: Collections.emptyList();
} else {
throw new UnsupportedOperationException("Not yet implemented");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public LegacyMetadataTypeHelper getMetadataTypeByName(String identifier) {
StructuralElementViewInterface divisionView = ruleset.getStructuralElementView("", "edit",
priorityList);
List<MetadataViewWithValuesInterface> entryViews = divisionView
.getSortedVisibleMetadata(Collections.emptyList(), Arrays.asList(identifier));
.getSortedVisibleMetadata(Collections.emptyList(), List.of(identifier));
MetadataViewInterface resultKeyView = entryViews.parallelStream()
.map(MetadataViewWithValuesInterface::getMetadata).filter(Optional::isPresent).map(Optional::get)
.filter(keyView -> keyView.getId().equals(identifier)).findFirst()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ private boolean executeRemainingScript(List<Process> processes)
switch (this.parameters.get("action")) {
case "generateImages":
String folders = parameters.get("folders");
List<String> foldersList = Arrays.asList("all");
List<String> foldersList = List.of("all");
if (Objects.nonNull(folders)) {
foldersList = Arrays.asList(folders.split(","));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ public boolean executeScript(Task task, String script, boolean automatic) throws
logger.info("Calling KitodoScript interpreter: {}", script);

KitodoScriptService kitodoScriptService = ServiceManager.getKitodoScriptService();
kitodoScriptService.execute(Arrays.asList(task.getProcess()), script);
kitodoScriptService.execute(Collections.singletonList(task.getProcess()), script);
executedSuccessful = true;
} else {
logger.info("Calling the shell: {}", script);
Expand Down

0 comments on commit da6394b

Please sign in to comment.