Java Code Examples for io.vavr.collection.List#empty()

The following examples show how to use io.vavr.collection.List#empty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BulkheadEventsEndpoint.java    From resilience4j with Apache License 2.0 6 votes vote down vote up
private List<BulkheadEvent> getBulkheadEvent(String bulkheadName) {
    CircularEventConsumer<BulkheadEvent> eventConsumer = eventConsumerRegistry
        .getEventConsumer(bulkheadName);
    if (eventConsumer == null) {
        CircularEventConsumer<BulkheadEvent> threadPoolEventConsumer = eventConsumerRegistry
            .getEventConsumer(
                String.join("-", ThreadPoolBulkhead.class.getSimpleName(), bulkheadName));
        if (threadPoolEventConsumer != null) {
            return threadPoolEventConsumer.getBufferedEvents()
                .filter(event -> event.getBulkheadName().equals(bulkheadName));
        } else {
            return List.empty();
        }
    } else {
        return eventConsumer.getBufferedEvents()
            .filter(event -> event.getBulkheadName().equals(bulkheadName));
    }
}
 
Example 2
Source File: CircuitBreakerEventsEndpoint.java    From resilience4j with Apache License 2.0 5 votes vote down vote up
private List<CircuitBreakerEvent> getCircuitBreakerEvents(String circuitBreakerName) {
    CircularEventConsumer<CircuitBreakerEvent> eventConsumer = eventConsumerRegistry
        .getEventConsumer(circuitBreakerName);
    if (eventConsumer != null) {
        return eventConsumer.getBufferedEvents()
            .filter(event -> event.getCircuitBreakerName().equals(circuitBreakerName));
    } else {
        return List.empty();
    }
}
 
Example 3
Source File: TimeLimiterEventsEndpoint.java    From resilience4j with Apache License 2.0 5 votes vote down vote up
private List<TimeLimiterEvent> getTimeLimiterEvents(String name) {
    CircularEventConsumer<TimeLimiterEvent> eventConsumer = eventsConsumerRegistry.getEventConsumer(name);
    if(eventConsumer != null){
        return eventConsumer.getBufferedEvents()
                .filter(event -> event.getTimeLimiterName().equals(name));
    }else{
        return List.empty();
    }
}
 
Example 4
Source File: RetryEventsEndpoint.java    From resilience4j with Apache License 2.0 5 votes vote down vote up
private List<RetryEvent> getRetryEvents(String name) {
    final CircularEventConsumer<RetryEvent> syncEvents = eventConsumerRegistry
        .getEventConsumer(name);
    if (syncEvents != null) {
        return syncEvents.getBufferedEvents()
            .filter(event -> event.getName().equals(name));
    } else {
        return List.empty();
    }
}
 
Example 5
Source File: RateLimiterEventsEndpoint.java    From resilience4j with Apache License 2.0 5 votes vote down vote up
private List<RateLimiterEvent> getRateLimiterEvents(String name) {
    CircularEventConsumer<RateLimiterEvent> eventConsumer = eventsConsumerRegistry
        .getEventConsumer(name);
    if (eventConsumer != null) {
        return eventConsumer.getBufferedEvents()
            .filter(event -> event.getRateLimiterName().equals(name));
    } else {
        return List.empty();
    }
}
 
Example 6
Source File: BeanTest.java    From vavr-jackson with Apache License 2.0 5 votes vote down vote up
@Test
public void testDeserializeScalarNull() throws IOException {
    // language=JSON
    String json = "{\"scalar\":null,\"value\":[]}";

    BeanObject actual = mapper().readValue(json, BeanObject.class);

    BeanObject expected = new BeanObject();
    expected.value = List.empty();
    Assertions.assertEquals(expected, actual);
}
 
Example 7
Source File: HealthReport.java    From ari-proxy with GNU Affero General Public License v3.0 4 votes vote down vote up
public static HealthReport empty() {
	return new HealthReport(List.empty());
}
 
Example 8
Source File: CollectionAPIUnitTest.java    From tutorials with MIT License 3 votes vote down vote up
@Test
public void givenEmptyList_whenStackAPI_thenCorrect() {

    List<Integer> intList = List.empty();

    List<Integer> intList1 = intList.pushAll(List.rangeClosed(5,10));

    assertEquals(intList1.peek(), Integer.valueOf(10));

    List intList2 = intList1.pop();
    assertEquals(intList2.size(), (intList1.size() - 1) );

}
 
Example 9
Source File: DataTableBuilder.java    From java-datatable with Apache License 2.0 2 votes vote down vote up
/**
 * DataTableBuilder. Private constructor. Used by the create() method.
 *
 * @param tableName The name of the table to create.
 */
private DataTableBuilder(String tableName) {
    this.tableName = tableName;
    this.dataColumns = List.empty();
}
 
Example 10
Source File: DataColumnCollection.java    From java-datatable with Apache License 2.0 2 votes vote down vote up
/**
 * DataColumnCollection constructor. Creates an empty Data Column Collection.
 *
 * @param table The table the column collection belongs to.
 */
DataColumnCollection(DataTable table) {
    this(table, List.empty());
}