File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
src/test/java/io/getstream/client Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 1313import okhttp3 .OkHttpClient ;
1414import org .junit .Test ;
1515
16+ import java .util .Collections ;
1617import java .util .List ;
1718import java .util .Optional ;
1819
@@ -48,9 +49,11 @@ public void getEnrichedActivities() throws Exception {
4849 .withUserReactions ("some-user" )
4950 .withReactionCounts ()
5051 .withRecentReactions ()).join ();
51- result .sort ((a , b ) -> {
52- int aLikes = a .getReactionCounts ().getOrDefault ("like" , 0 ).intValue ();
53- int bLikes = b .getReactionCounts ().getOrDefault ("like" , 0 ).intValue ();
52+ Collections .sort (result , (a , b ) -> {
53+ Number aValue = a .getReactionCounts ().get ("like" );
54+ Number bValue = b .getReactionCounts ().get ("like" );
55+ int aLikes = aValue == null ? 0 : aValue .intValue ();
56+ int bLikes = bValue == null ? 0 : bValue .intValue ();
5457 return aLikes - bLikes ;
5558 });
5659 }
You can’t perform that action at this time.
0 commit comments