use of com.annimon.stream.OptionalLong in project Lightweight-Stream-API by aNNiMON.
the class OptionalLongMatcherTest method testIsPresent.
@Test
public void testIsPresent() {
OptionalLong optional = OptionalLong.of(5L);
assertThat(optional, isPresent());
assertThat(optional, not(isEmpty()));
assertThat(isPresent(), description(is("OptionalLong value should be present")));
}
use of com.annimon.stream.OptionalLong in project Signal-Android by WhisperSystems.
the class CallParticipantsListDialog method updateList.
private void updateList(@NonNull CallParticipantsState callParticipantsState) {
List<MappingModel<?>> items = new ArrayList<>();
boolean includeSelf = callParticipantsState.getGroupCallState() == WebRtcViewModel.GroupCallState.CONNECTED_AND_JOINED;
OptionalLong headerCount = callParticipantsState.getParticipantCount();
headerCount.executeIfPresent(count -> {
items.add(new CallParticipantsListHeader((int) count));
if (includeSelf) {
items.add(new CallParticipantViewState(callParticipantsState.getLocalParticipant()));
}
for (CallParticipant callParticipant : callParticipantsState.getAllRemoteParticipants()) {
items.add(new CallParticipantViewState(callParticipant));
}
});
adapter.submitList(items);
}
use of com.annimon.stream.OptionalLong in project Signal-Android by signalapp.
the class CallParticipantsListDialog method updateList.
private void updateList(@NonNull CallParticipantsState callParticipantsState) {
List<MappingModel<?>> items = new ArrayList<>();
boolean includeSelf = callParticipantsState.getGroupCallState() == WebRtcViewModel.GroupCallState.CONNECTED_AND_JOINED;
OptionalLong headerCount = callParticipantsState.getParticipantCount();
headerCount.executeIfPresent(count -> {
items.add(new CallParticipantsListHeader((int) count));
if (includeSelf) {
items.add(new CallParticipantViewState(callParticipantsState.getLocalParticipant()));
}
for (CallParticipant callParticipant : callParticipantsState.getAllRemoteParticipants()) {
items.add(new CallParticipantViewState(callParticipant));
}
});
adapter.submitList(items);
}
Aggregations