Skip to content

Commit

Permalink
Add IsEmpty to the builders
Browse files Browse the repository at this point in the history
  • Loading branch information
badeend committed Mar 16, 2024
1 parent 27d2b57 commit a72708f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Badeend.ValueCollections/ValueListBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,15 @@ private List<T> Mutate()
/// </summary>
public int Count => this.Read().Count;

/// <summary>
/// Shortcut for <c>.Count == 0</c>.
/// </summary>
public bool IsEmpty
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => this.Count == 0;
}

/// <inheritdoc/>
bool ICollection<T>.IsReadOnly => false;

Expand Down
9 changes: 9 additions & 0 deletions Badeend.ValueCollections/ValueSetBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,15 @@ private static IEnumerable<T> PreferHashSet(IEnumerable<T> input)
/// </summary>
public int Count => this.Read().Count;

/// <summary>
/// Shortcut for <c>.Count == 0</c>.
/// </summary>
public bool IsEmpty
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => this.Count == 0;
}

/// <inheritdoc/>
bool ICollection<T>.IsReadOnly => false;

Expand Down

0 comments on commit a72708f

Please sign in to comment.