Skip to content

Commit

Permalink
Seq min utility
Browse files Browse the repository at this point in the history
  • Loading branch information
Anuken committed Jun 30, 2024
1 parent 7d6e89d commit e6aadf7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions arc-core/src/arc/struct/Seq.java
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,17 @@ public T min(Boolf<T> filter, Floatf<T> func){
return result;
}

public T min(Boolf<T> filter, Comparator<T> func){
T result = null;
for(int i = 0; i < size; i++){
T t = items[i];
if(filter.get(t) && (result == null || func.compare(result, t) > 0)){
result = t;
}
}
return result;
}

public T min(Floatf<T> func){
T result = null;
float min = Float.MAX_VALUE;
Expand Down

0 comments on commit e6aadf7

Please sign in to comment.