Skip to content

Commit

Permalink
Optimize requirements and some utils
Browse files Browse the repository at this point in the history
  • Loading branch information
iiAhmedYT committed Jul 16, 2024
1 parent 6e88093 commit 6fbe25e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ public final class RequirementManager {
* @return the Requirement object that matches the given type, or null if no match is found
*/
public Requirement<?> getRequirementByType(final String type) {
return this.requirements.stream().filter(requirement -> requirement.matchIdentifier(type)).findAny().orElse(null);
for (final Requirement<?> requirement : this.requirements) {
if (requirement.matchIdentifier(type)) {
return requirement;
}
}
return null;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/to/itsme/itsmyconfig/util/Strings.java
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,12 @@ public static String integerToRoman(int num) {
}

/**
* Converts a list of objects to a string, where each object is represented on a new line.
* Converts a list of strings to a string, where each string is represented on a new line.
*
* @param list The list of objects to be converted to a string.
* @param list The list of strings to be converted to a string.
* @return The string representation of the list.
*/
public static String toString(final @NotNull List<?> list) {
public static String toString(final @NotNull List<String> list) {
return String.join(System.lineSeparator(), list.stream().map(Object::toString).toArray(String[]::new));
}

Expand Down

0 comments on commit 6fbe25e

Please sign in to comment.