Skip to content

Commit 3416d67

Browse files
committed
Fixed idea warnings.
1 parent 3aecb05 commit 3416d67

File tree

1 file changed

+3
-3
lines changed
  • src/main/java/com/github/underscore

1 file changed

+3
-3
lines changed

src/main/java/com/github/underscore/U.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ public static <T, E> List<T> mapMulti(final List<E> list,
322322
final BiConsumer<? super E, ? super Consumer<T>> mapper) {
323323
final List<T> transformed = newArrayListWithExpectedSize(list.size());
324324
for (E element : list) {
325-
Consumer<T> value = t -> transformed.add(t);
325+
Consumer<T> value = transformed::add;
326326
mapper.accept(element, value);
327327
}
328328
return transformed;
@@ -920,7 +920,7 @@ public <E extends Comparable<? super E>> List<E> sortWith(final Comparator<E> co
920920
public static <E, T extends Comparable<? super T>> List<E> sortBy(final Iterable<E> iterable,
921921
final Function<E, T> func) {
922922
final List<E> sortedList = newArrayList(iterable);
923-
sortedList.sort((o1, o2) -> func.apply(o1).compareTo(func.apply(o2)));
923+
sortedList.sort(Comparator.comparing(func::apply));
924924
return sortedList;
925925
}
926926

@@ -932,7 +932,7 @@ public <E, V extends Comparable<? super V>> List<E> sortBy(final Function<E, V>
932932
public static <K, V extends Comparable<? super V>> List<Map<K, V>> sortBy(final Iterable<Map<K, V>> iterable,
933933
final K key) {
934934
final List<Map<K, V>> sortedList = newArrayList(iterable);
935-
sortedList.sort((o1, o2) -> o1.get(key).compareTo(o2.get(key)));
935+
sortedList.sort(Comparator.comparing(o -> o.get(key)));
936936
return sortedList;
937937
}
938938

0 commit comments

Comments
 (0)