Skip to content

Commit

Permalink
SortedList consumer super generic
Browse files Browse the repository at this point in the history
  • Loading branch information
safris committed Dec 17, 2024
1 parent 79d4a80 commit ff1167e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/main/java/org/libj/util/SortedList.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import static org.libj.lang.Assertions.*;

import java.lang.reflect.ParameterizedType;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
Expand All @@ -36,7 +35,7 @@ public class SortedList<E,L extends List<E>> extends ObservableList<E,L> {
@SuppressWarnings("rawtypes")
private static final Comparator DEFAULT_COMPARATOR = Comparator.nullsFirst(Comparator.naturalOrder());

private final Comparator<E> comparator;
private final Comparator<? super E> comparator;

/**
* Creates a new {@link SortedList} with the provided {@link List list} of elements as the underlying target, and the
Expand All @@ -60,11 +59,11 @@ public SortedList(final L list) {
* {@linkplain Comparable natural ordering} should be used.
* @throws NullPointerException If the provided {@link List list} or {@link Comparator comparator} is null.
*/
public SortedList(final L list, final Comparator<E> comparator) {
public SortedList(final L list, final Comparator<? super E> comparator) {
this(list, Objects.requireNonNull(comparator), true);
}

private SortedList(final L list, final Comparator<E> comparator, final boolean sort) {
private SortedList(final L list, final Comparator<? super E> comparator, final boolean sort) {
super(list);
this.comparator = comparator;
if (sort)
Expand Down

0 comments on commit ff1167e

Please sign in to comment.