You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2020/01/08 08:35:13 UTC
[lucenenet] 04/06: Lucene.Net.Index.FilterDirectoryReader:
Eliminated unnecessary O(n + n) operation
This is an automated email from the ASF dual-hosted git repository.
nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git
commit c08eb10d0cc6efa6ccf7205dff0b1ed080f83a01
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Tue Jan 7 21:31:32 2020 +0700
Lucene.Net.Index.FilterDirectoryReader: Eliminated unnecessary O(n + n) operation
---
src/Lucene.Net/Index/FilterDirectoryReader.cs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/Lucene.Net/Index/FilterDirectoryReader.cs b/src/Lucene.Net/Index/FilterDirectoryReader.cs
index f53dd85..d0262cf 100644
--- a/src/Lucene.Net/Index/FilterDirectoryReader.cs
+++ b/src/Lucene.Net/Index/FilterDirectoryReader.cs
@@ -41,12 +41,12 @@ namespace Lucene.Net.Index
/// </summary>
public abstract class SubReaderWrapper
{
- internal virtual AtomicReader[] Wrap(IList<AtomicReader> readers)
+ internal virtual AtomicReader[] Wrap(IList<IndexReader> readers) // LUCENENET specific: Changed from IList<AtomicReader> to IList<IndexReader> to eliminate cast in calling method
{
AtomicReader[] wrapped = new AtomicReader[readers.Count];
for (int i = 0; i < readers.Count; i++)
{
- wrapped[i] = Wrap(readers[i]);
+ wrapped[i] = Wrap((AtomicReader)readers[i]);
}
return wrapped;
}
@@ -100,7 +100,7 @@ namespace Lucene.Net.Index
/// <param name="input"> the <see cref="DirectoryReader"/> to filter </param>
/// <param name="wrapper"> the <see cref="SubReaderWrapper"/> to use to wrap subreaders </param>
public FilterDirectoryReader(DirectoryReader input, SubReaderWrapper wrapper)
- : base(input.Directory, wrapper.Wrap(input.GetSequentialSubReaders().OfType<AtomicReader>().ToList()))
+ : base(input.Directory, wrapper.Wrap(input.GetSequentialSubReaders()))
{
this.m_input = input;
}