diff --git a/lib/src/ilist/ilist.dart b/lib/src/ilist/ilist.dart index c7ec2a1..3d2c861 100644 --- a/lib/src/ilist/ilist.dart +++ b/lib/src/ilist/ilist.dart @@ -18,7 +18,7 @@ import "l_flat.dart"; @immutable class IListEmpty // ignore: must_be_immutable extends IList { - /// Creates a empty list. In most cases, you should use `const IList.empty()`. + /// Creates an empty list. In most cases, you should use `const IList.empty()`. /// /// IMPORTANT: You must always use the `const` keyword. /// It's always wrong to use an `IListEmpty()` which is not constant. @@ -29,7 +29,7 @@ class IListEmpty // ignore: must_be_immutable @override final ConfigList config; - /// A empty list is always flushed, by definition. + /// An empty list is always flushed, by definition. @override bool get isFlushed => true; @@ -37,6 +37,14 @@ class IListEmpty // ignore: must_be_immutable @override IListEmpty get flush => this; + /// An empty list is always empty, by definition + @override + bool get isEmpty => true; + + /// An empty list is always empty, by definition + @override + bool get isNotEmpty => false; + @override int get _counter => 0; diff --git a/lib/src/imap/imap.dart b/lib/src/imap/imap.dart index bfa0e0f..d0237ca 100644 --- a/lib/src/imap/imap.dart +++ b/lib/src/imap/imap.dart @@ -19,7 +19,7 @@ import "m_replace.dart"; @immutable class IMapEmpty // ignore: must_be_immutable extends IMap { - /// Creates a empty map. In most cases, you should use `const IMap.empty()`. + /// Creates an empty map. In most cases, you should use `const IMap.empty()`. /// /// IMPORTANT: You must always use the `const` keyword. /// It's always wrong to use an `IMapEmpty()` which is not constant. @@ -30,7 +30,7 @@ class IMapEmpty // ignore: must_be_immutable @override final ConfigMap config; - /// A empty map is always flushed, by definition. + /// An empty map is always flushed, by definition. @override bool get isFlushed => true; @@ -38,6 +38,14 @@ class IMapEmpty // ignore: must_be_immutable @override IMapEmpty get flush => this; + /// An empty map is always empty, by definition + @override + bool get isEmpty => true; + + /// An empty map is always empty, by definition + @override + bool get isNotEmpty => false; + @override int get _counter => 0; diff --git a/lib/src/iset/iset.dart b/lib/src/iset/iset.dart index 84818ef..4a39203 100644 --- a/lib/src/iset/iset.dart +++ b/lib/src/iset/iset.dart @@ -18,7 +18,7 @@ import "s_flat.dart"; @immutable class ISetEmpty // ignore: must_be_immutable extends ISet { - /// Creates a empty set. In most cases, you should use `const ISet.empty()`. + /// Creates an empty set. In most cases, you should use `const ISet.empty()`. /// /// IMPORTANT: You must always use the `const` keyword. /// It's always wrong to use an `ISetEmpty()` which is not constant. @@ -29,7 +29,7 @@ class ISetEmpty // ignore: must_be_immutable @override final ConfigSet config; - /// A empty set is always flushed, by definition. + /// An empty set is always flushed, by definition. @override bool get isFlushed => true; @@ -37,6 +37,14 @@ class ISetEmpty // ignore: must_be_immutable @override ISetEmpty get flush => this; + /// An empty set is always empty, by definition + @override + bool get isEmpty => true; + + /// An empty set is always empty, by definition + @override + bool get isNotEmpty => false; + @override int get _counter => 0; diff --git a/test/ilist/ilist_empty_test.dart b/test/ilist/ilist_empty_test.dart index e4b06bf..18c7c14 100644 --- a/test/ilist/ilist_empty_test.dart +++ b/test/ilist/ilist_empty_test.dart @@ -72,4 +72,9 @@ void main() { expect(const IList.empty().equalItemsAndConfig(const IList.empty()), isTrue); expect(const IList.empty().equalItemsAndConfig(const IListEmpty()), isTrue); }); + + test(".isEmpty() | .isNotEmpty()", () { + expect(const IList.empty().isEmpty, isTrue); + expect(const IList.empty().isNotEmpty, isFalse); + }); } diff --git a/test/imap/imap_empty_test.dart b/test/imap/imap_empty_test.dart index 6ad8b2e..41a6844 100644 --- a/test/imap/imap_empty_test.dart +++ b/test/imap/imap_empty_test.dart @@ -81,4 +81,9 @@ void main() { expect(const IMap.empty().equalItemsAndConfig(const IMap.empty()), isTrue); expect(const IMap.empty().equalItemsAndConfig(const IMapEmpty()), isTrue); }); + + test(".isEmpty() | .isNotEmpty()", () { + expect(const IMap.empty().isEmpty, isTrue); + expect(const IMap.empty().isNotEmpty, isFalse); + }); } diff --git a/test/iset/iset_empty_test.dart b/test/iset/iset_empty_test.dart index 2890a3a..7eba763 100644 --- a/test/iset/iset_empty_test.dart +++ b/test/iset/iset_empty_test.dart @@ -72,4 +72,9 @@ void main() { expect(const ISet.empty().equalItemsAndConfig(const ISet.empty()), isTrue); expect(const ISet.empty().equalItemsAndConfig(const ISetEmpty()), isTrue); }); + + test(".isEmpty() | .isNotEmpty()", () { + expect(const ISet.empty().isEmpty, isTrue); + expect(const ISet.empty().isNotEmpty, isFalse); + }); }