blob: 0dee12a9d623d26e9bd8911e5ff7a20388a3620c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Collections.Generic;
namespace Mono.Linker
{
struct ArrayBuilder<T>
{
private List<T> _list;
public void Add (T value) => (_list ??= new List<T> ()).Add (value);
public bool Any (Predicate<T> callback) => _list?.Exists (callback) == true;
public T[]? ToArray () => _list?.ToArray ();
public int Count => _list?.Count ?? 0;
}
}
|