Source:
<code>private void setupFilterAndChannel() { Filter elementFilter = null; <START> if (filter != null) { <END> if (filter == Filters.isNull()) { return; } hasPositionalFilter = filter instanceof Filters.PositionalFilter; int numFilters = Filters.getNumDistinctPositionFilters(filter) + 1; subscriptToFilter = new Long2ObjectOpenHashMap[numFilters]; setupFilters: for (Filter arrayFilter : Filters.getDistinctPositionFilters(filter)) { if (arrayFilter == Filters.isNotNull()) { continue; } Filters.StructFilter listFilter = (Filters.StructFilter) arrayFilter; int ordinal = listFilter.getOrdinal(); Map<PathElement, Filter> filters = listFilter.getFilters(); for (Map.Entry<PathElement, Filter> entry : filters.entrySet()) { if (entry.getKey() instanceof AllSubscripts) { verify(filters.size() == 1, "Only one elementFilter is allowed if no subscript is given"); elementFilter = entry.getValue(); break setupFilters; } verify(entry.getKey() instanceof LongSubscript); long subscript = ((LongSubscript) entry.getKey()).getIndex(); if (subscriptToFilter[ordinal] == null) { subscriptToFilter[ordinal] = new Long2ObjectOpenHashMap(); if (positionalFilter == null) { positionalFilter = new Filters.PositionalFilter(listFilter); elementFilter = positionalFilter; } } subscriptToFilter[ordinal].put(subscript - 1, entry.getValue()); } } if (!hasPositionalFilter) { globalNumFilters = subscriptToFilter[0].size(); } } elementStreamReader.setFilterAndChannel(elementFilter, outputChannel, -1, type.getTypeParameters().get(0)); filterIsSetup = true; }</code><technical_language>for readability, consider processing filter == null case first: if (filter == null) { elementStreamReader.setFilterAndChannel(null, outputChannel, -1, type.getTypeParameters().get(0)); filterIsSetup = true; return; } if (Filters.isNull().equals(filter)) { filterIsSetup = true; return; } Filter elementFilter = null; ..</technical_language>

Target:
private void setupFilterAndChannel() { if (filter == null) { elementStreamReader.setFilterAndChannel(null, outputChannel, -1, type.getTypeParameters().get(0)); filterIsSetup = true; return; } Filter elementFilter = null; if (filter == Filters.isNull()) { filterIsSetup = true; return; } hasPositionalFilter = filter instanceof Filters.PositionalFilter; List<Filter> positionFilters = Filters.getDistinctPositionFilters(filter); int numFilters = positionFilters.size() + 1; subscriptToFilter = new Long2ObjectOpenHashMap[numFilters]; setupFilters: for (Filter positionFilter : positionFilters) { if (positionFilter == Filters.isNotNull()) { continue; } verify(positionFilter instanceof StructFilter); Filters.StructFilter listFilter = (Filters.StructFilter) positionFilter; int ordinal = listFilter.getOrdinal(); Map<PathElement, Filter> filters = listFilter.getFilters(); for (Map.Entry<PathElement, Filter> entry : filters.entrySet()) { if (entry.getKey() instanceof AllSubscripts) { verify(filters.size() == 1, "Only one elementFilter is allowed if no subscript is given"); elementFilter = entry.getValue(); break setupFilters; } verify(entry.getKey() instanceof LongSubscript); long subscript = ((LongSubscript) entry.getKey()).getIndex(); if (subscriptToFilter[ordinal] == null) { subscriptToFilter[ordinal] = new Long2ObjectOpenHashMap(); if (positionalFilter == null) { positionalFilter = new Filters.PositionalFilter(listFilter); elementFilter = positionalFilter; } } subscriptToFilter[ordinal].put(subscript - 1, entry.getValue()); } } if (!hasPositionalFilter) { globalNumFilters = subscriptToFilter[0].size(); } elementStreamReader.setFilterAndChannel(elementFilter, outputChannel, -1, type.getTypeParameters().get(0)); filterIsSetup = true; }