Example usage for java.util NavigableSet removeIf

List of usage examples for java.util NavigableSet removeIf

Introduction

In this page you can find the example usage for java.util NavigableSet removeIf.

Prototype

default boolean removeIf(Predicate<? super E> filter) 

Source Link

Document

Removes all of the elements of this collection that satisfy the given predicate.

Usage

From source file:com.ejisto.modules.dao.local.LocalMockedFieldsDao.java

private MockedField saveField(MockedField field, boolean update) {
    MockedField newField = cloneField(field);
    NavigableSet<MockedFieldContainer> container;
    Optional<NavigableSet<MockedFieldContainer>> result = getDatabase().getMockedFields(field.getContextPath());
    if (!result.isPresent()) {
        getDatabase().registerContextPath(field.getContextPath());
        container = getDatabase().getMockedFields(field.getContextPath())
                .orElseThrow(IllegalStateException::new);
    } else {/*from  ww w .j a  v  a  2s  . c  o m*/
        container = result.get();
    }
    if (update) {
        container.removeIf(c -> c.wraps(newField));
    }
    container.add(MockedFieldContainer.from(field));
    return newField;
}