@Test public void isCleanWhenTheDatabaseContainsNoData() throws Exception { BdbWrapper emptyDatabase = creator.getDatabase( "a", "b", "empty", true, STRING_BINDER, STRING_BINDER, IS_CLEAN_HANDLER ); assertThat(emptyDatabase.isClean(), is(true)); }
public boolean isClean() { try (Stream<KeyT> keys = databaseGetter().getAll().getKeys(new NonFilteringKeyRetriever<>())) { if (!keys.findAny().isPresent()) { return true; } } try (Stream<ValueT> values = databaseGetter().key(isCleanHandler.getKey()).dontSkip().forwards().getValues( new NonFilteringValueRetriever<>())) { Optional<ValueT> first = values.findFirst(); if (first.isPresent()) { ValueT value = first.get(); return Objects.equals(value, isCleanHandler.getValue()); } } return false; }
BdbWrapper { public boolean isClean() { try (Stream<KeyT> keys = databaseGetter().getAll().getKeys(new NonFilteringKeyRetriever<>())) { if (!keys.findAny().isPresent()) { return true; } } try (Stream<ValueT> values = databaseGetter().key(isCleanHandler.getKey()).dontSkip().forwards().getValues( new NonFilteringValueRetriever<>())) { Optional<ValueT> first = values.findFirst(); if (first.isPresent()) { ValueT value = first.get(); return Objects.equals(value, isCleanHandler.getValue()); } } return false; } }
BdbWrapper { public boolean isClean() { try (Stream<KeyT> keys = databaseGetter().getAll().getKeys(new NonFilteringKeyRetriever<>())) { if (!keys.findAny().isPresent()) { return true; } } try (Stream<ValueT> values = databaseGetter().key(isCleanHandler.getKey()).dontSkip().forwards().getValues( new NonFilteringValueRetriever<>())) { Optional<ValueT> first = values.findFirst(); if (first.isPresent()) { ValueT value = first.get(); return Objects.equals(value, isCleanHandler.getValue()); } } return false; } BdbWrapper(Environment dbEnvironment, Database database, DatabaseConfig databaseConfig,
                    EntryBinding<KeyT> keyBinder, EntryBinding<ValueT> valueBinder,
                    IsCleanHandler<KeyT, ValueT> isCleanHandler); }
BdbWrapper { public boolean isClean() { try (Stream<KeyT> keys = databaseGetter().getAll().getKeys(new NonFilteringKeyRetriever<>())) { if (!keys.findAny().isPresent()) { return true; } } try (Stream<ValueT> values = databaseGetter().key(isCleanHandler.getKey()).dontSkip().forwards().getValues( new NonFilteringValueRetriever<>())) { Optional<ValueT> first = values.findFirst(); if (first.isPresent()) { ValueT value = first.get(); return Objects.equals(value, isCleanHandler.getValue()); } } return false; } BdbWrapper(Environment dbEnvironment, Database database, DatabaseConfig databaseConfig,
                    EntryBinding<KeyT> keyBinder, EntryBinding<ValueT> valueBinder,
                    IsCleanHandler<KeyT, ValueT> isCleanHandler); void beginTransaction(); void close(); DatabaseGetter.Builder<KeyT, ValueT> databaseGetter(); boolean isClean(); void commit(); void replace(KeyT key, ValueT initialValue, Function<ValueT, ValueT> replacer); boolean put(KeyT key, ValueT value); boolean delete(KeyT key, ValueT value); List<String> dump(String prefix, int start, int count, LockMode lockMode); void empty(); KeyValueConverter<KeyT, ValueT, U> keyValueConverter(BiFunction<KeyT, ValueT, U> converter); KeyRetriever<KeyT> keyRetriever(); ValueRetriever<ValueT> valueRetriever(); }
BdbWrapper { public boolean isClean() { try (Stream<KeyT> keys = databaseGetter().getAll().getKeys(new NonFilteringKeyRetriever<>())) { if (!keys.findAny().isPresent()) { return true; } } try (Stream<ValueT> values = databaseGetter().key(isCleanHandler.getKey()).dontSkip().forwards().getValues( new NonFilteringValueRetriever<>())) { Optional<ValueT> first = values.findFirst(); if (first.isPresent()) { ValueT value = first.get(); return Objects.equals(value, isCleanHandler.getValue()); } } return false; } BdbWrapper(Environment dbEnvironment, Database database, DatabaseConfig databaseConfig,
                    EntryBinding<KeyT> keyBinder, EntryBinding<ValueT> valueBinder,
                    IsCleanHandler<KeyT, ValueT> isCleanHandler); void beginTransaction(); void close(); DatabaseGetter.Builder<KeyT, ValueT> databaseGetter(); boolean isClean(); void commit(); void replace(KeyT key, ValueT initialValue, Function<ValueT, ValueT> replacer); boolean put(KeyT key, ValueT value); boolean delete(KeyT key, ValueT value); List<String> dump(String prefix, int start, int count, LockMode lockMode); void empty(); KeyValueConverter<KeyT, ValueT, U> keyValueConverter(BiFunction<KeyT, ValueT, U> converter); KeyRetriever<KeyT> keyRetriever(); ValueRetriever<ValueT> valueRetriever();  }