Skip to content

Commit 426a274

Browse files
committed
Fixing lint issues
1 parent 5ab8a76 commit 426a274

File tree

2 files changed

+2
-36
lines changed

2 files changed

+2
-36
lines changed

2024/src/main/java/me/zodac/advent/Day22.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ public static long calculateMaximumPossibleBananas(final Collection<Integer> ini
8787

8888
final Collection<Long> existingDiffs = new HashSet<>();
8989

90+
final int numberOfPrices = prices.size();
9091
long runningDiff = 0L;
91-
for (int i = 1; i < prices.size(); i++) {
92+
for (int i = 1; i < numberOfPrices; i++) {
9293
// Diff calculated based on following logic, gives a concise value for the diff that can be used for comparisons
9394
// https://github.com/p-kovacs/advent-of-code-2024/blob/master/src/main/java/com/github/pkovacs/aoc/y2024/Day22.java#L33
9495
runningDiff = (runningDiff % DIFF_RADIX_CUBED) * DIFF_RADIX + (prices.get(i) - prices.get(i - 1) + DIFF_RADIX_OFFSET);
@@ -169,5 +170,4 @@ private static long mix(final long first, final long second) {
169170
private static long prune(final long input) {
170171
return input % PRUNE_CONSTANT;
171172
}
172-
173173
}

common-utils/src/main/java/me/zodac/advent/input/InputReader.java

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -365,40 +365,6 @@ private Grouper(final Stream<? extends T> stream) {
365365
this.stream = stream;
366366
}
367367

368-
/**
369-
* Groups the {@code stream} of lines into {@link List}s, where each group has a size of {@code sizeOfGroup}.
370-
*
371-
* @param sizeOfGroup the size of the groups
372-
* @return the group of {@link List}s of lines of the output type
373-
*/
374-
public List<List<T>> bySize(final int sizeOfGroup) {
375-
final List<? extends T> list = stream.toList();
376-
final List<List<T>> groups = new ArrayList<>();
377-
final int sizeOfList = list.size();
378-
List<T> currentGroup = new ArrayList<>();
379-
currentGroup.add(list.getFirst());
380-
381-
for (int i = 1; i < sizeOfList; i++) {
382-
final T line = list.get(i);
383-
384-
if (i % sizeOfGroup == 0) {
385-
if (!currentGroup.isEmpty()) {
386-
groups.add(currentGroup);
387-
}
388-
currentGroup = new ArrayList<>();
389-
currentGroup.add(line);
390-
} else {
391-
currentGroup.add(line);
392-
}
393-
}
394-
395-
// Add last group if not empty
396-
if (!currentGroup.isEmpty()) {
397-
groups.add(currentGroup);
398-
}
399-
return groups;
400-
}
401-
402368
/**
403369
* Groups the {@code stream} of lines into {@link List}s, where each group is a split that is delimited when the provided
404370
* {@link Predicate} is met.

0 commit comments

Comments
 (0)