mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 15:07:44 +08:00
Use Array.Empty
instead of constructed list
This commit is contained in:
parent
249f0f9697
commit
deb1670862
@ -15,21 +15,14 @@ namespace osu.Game.Database
|
|||||||
{
|
{
|
||||||
public class EmptyRealmSet<T> : IRealmCollection<T>
|
public class EmptyRealmSet<T> : IRealmCollection<T>
|
||||||
{
|
{
|
||||||
private static List<T> emptySet => new List<T>();
|
private IList<T> emptySet => Array.Empty<T>();
|
||||||
|
|
||||||
public IEnumerator<T> GetEnumerator()
|
|
||||||
{
|
|
||||||
return emptySet.GetEnumerator();
|
|
||||||
}
|
|
||||||
|
|
||||||
IEnumerator IEnumerable.GetEnumerator()
|
|
||||||
{
|
|
||||||
return ((IEnumerable)emptySet).GetEnumerator();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public IEnumerator<T> GetEnumerator() => emptySet.GetEnumerator();
|
||||||
|
IEnumerator IEnumerable.GetEnumerator() => emptySet.GetEnumerator();
|
||||||
public int Count => emptySet.Count;
|
public int Count => emptySet.Count;
|
||||||
|
|
||||||
public T this[int index] => emptySet[index];
|
public T this[int index] => emptySet[index];
|
||||||
|
public int IndexOf(object item) => emptySet.IndexOf((T)item);
|
||||||
|
public bool Contains(object item) => emptySet.Contains((T)item);
|
||||||
|
|
||||||
public event NotifyCollectionChangedEventHandler? CollectionChanged
|
public event NotifyCollectionChangedEventHandler? CollectionChanged
|
||||||
{
|
{
|
||||||
@ -43,32 +36,11 @@ namespace osu.Game.Database
|
|||||||
remove => throw new NotImplementedException();
|
remove => throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int IndexOf(object item)
|
public IRealmCollection<T> Freeze() => throw new NotImplementedException();
|
||||||
{
|
public IDisposable SubscribeForNotifications(NotificationCallbackDelegate<T> callback) => throw new NotImplementedException();
|
||||||
return emptySet.IndexOf((T)item);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Contains(object item)
|
|
||||||
{
|
|
||||||
return emptySet.Contains((T)item);
|
|
||||||
}
|
|
||||||
|
|
||||||
public IRealmCollection<T> Freeze()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public IDisposable SubscribeForNotifications(NotificationCallbackDelegate<T> callback)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsValid => throw new NotImplementedException();
|
public bool IsValid => throw new NotImplementedException();
|
||||||
|
|
||||||
public Realm Realm => throw new NotImplementedException();
|
public Realm Realm => throw new NotImplementedException();
|
||||||
|
|
||||||
public ObjectSchema ObjectSchema => throw new NotImplementedException();
|
public ObjectSchema ObjectSchema => throw new NotImplementedException();
|
||||||
|
|
||||||
public bool IsFrozen => throw new NotImplementedException();
|
public bool IsFrozen => throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user