On Fri, 19 Apr 2024 at 08:26, Claude Warren <cla...@xenei.com> wrote:

> While the Deque makes clear the idea of enqueueing and dequeueing  the
> layers it does not have the method to natively traverse and extract entries
> from the middle of the queue.  Nor would I expect it to.  So I think the
> Deque does not accurately reflect how the collection of Bloom filters is
> utilized.
>

You can traverse and remove entries with the Iterator of the Deque:

Deque<Integer> d = new LinkedList<>();
d.addAll(Arrays.asList(1, 2, 3, 4, 5));
for (Iterator<Integer> it = d.iterator(); it.hasNext();) {
    int i = it.next();
    if (i == 3) {
        it.remove();
    }
}
System.out.println(d);

prints:

[1, 2, 4, 5]

So it is easy to iterate the layers and remove them in Order(1) time (per
removal).

Alex


>
> On Wed, Apr 17, 2024 at 2:17 PM Alex Herbert <alex.d.herb...@gmail.com>
> wrote:
>
> > Looks good to me.
> >
> > Any opinions on changing the LayerManager to keep the layers in a Deque
> > rather than a LinkedList. I think it would only require a change to the
> > following method:
> >
> > public final BloomFilter get(int depth)
> >
> > Performance will be the same as the Deque can be a LinkedList. This is
> more
> > about how any custom downstream code is currently using the collection of
> > layers.
> >
> > Alex
>
>

Reply via email to