Java Code Examples for java.util.Queue#clear()
The following examples show how to use
java.util.Queue#clear() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FluxGroupBy.java From reactor-core with Apache License 2.0 | 6 votes |
boolean checkTerminated(boolean d, boolean empty, Subscriber<?> a, Queue<GroupedFlux<K, V>> q) { if (d) { Throwable e = error; if (e != null && e != Exceptions.TERMINATED) { q.clear(); signalAsyncError(); return true; } else if (empty) { a.onComplete(); return true; } } return false; }
Example 2
Source File: TopicFlusher.java From divolte-collector with Apache License 2.0 | 6 votes |
@Override public final ProcessingDirective process(final Queue<Item<AvroRecordBuffer>> batch) { final int batchSize = batch.size(); final ProcessingDirective result; switch (batchSize) { case 0: logger.warn("Ignoring empty batch of events."); result = CONTINUE; break; case 1: result = process(batch.remove()); break; default: logger.debug("Processing batch of {} events.", batchSize); final List<T> messages = batch.stream() .map(i -> i.payload) .map(this::buildRecord) .collect(Collectors.toCollection(() -> new ArrayList<>(batchSize))); // Clear the messages now; on failure they'll be retried as part of our // pending operation. batch.clear(); result = flush(messages); } return result; }
Example 3
Source File: UnicastProcessor.java From reactive-streams-commons with Apache License 2.0 | 6 votes |
boolean checkTerminated(boolean d, boolean empty, Subscriber<? super T> a, Queue<T> q) { if (cancelled) { q.clear(); actual = null; return true; } if (d && empty) { Throwable e = error; actual = null; if (e != null) { a.onError(e); } else { a.onComplete(); } return true; } return false; }
Example 4
Source File: FluxReceive.java From reactor-netty with Apache License 2.0 | 5 votes |
final void terminateReceiver(@Nullable Queue<?> q, CoreSubscriber<?> a) { if (q != null) { q.clear(); } Throwable ex = inboundError; receiver = null; if (ex != null) { //parent.listener.onReceiveError(channel, ex); a.onError(ex); } else { a.onComplete(); } }
Example 5
Source File: ComponentUtils.java From rice with Educational Community License v2.0 | 5 votes |
/** * places a key, value pair in each context map of a list of components * * @param elements the list of elements * @param contextName a value to be used as a key to retrieve the object * @param contextValue the value to be placed in the context */ public static void pushObjectToContext(Collection<? extends LifecycleElement> elements, String contextName, Object contextValue) { if (elements == null || elements.isEmpty()) { return; } Queue<LifecycleElement> elementQueue = new LinkedList<LifecycleElement>(); try { elementQueue.addAll(elements); while (!elementQueue.isEmpty()) { LifecycleElement currentElement = elementQueue.poll(); if (currentElement == null) { continue; } if (currentElement instanceof Component) { ((Component) currentElement).pushObjectToContext(contextName, contextValue); } elementQueue.addAll(ViewLifecycleUtils.getElementsForLifecycle(currentElement).values()); } } finally { elementQueue.clear(); RecycleUtils.recycle(elementQueue); } }
Example 6
Source File: SmallPriorityQueueTest.java From JAADAS with GNU General Public License v3.0 | 5 votes |
@Test public void testClear() { Queue<Integer> q = PriorityQueue.of(universe1); q.clear(); assertEquals(q.size(), 0); assertTrue(q.isEmpty()); assertNull(q.peek()); assertNull(q.poll()); for (Integer i : universe1) assertFalse(q.contains(i)); }
Example 7
Source File: FluxWindowPredicate.java From reactor-core with Apache License 2.0 | 5 votes |
void drainFused() { int missed = 1; final Subscriber<? super Flux<T>> a = actual; final Queue<Flux<T>> q = queue; for (; ; ) { if (cancelled != 0) { q.clear(); return; } boolean d = done; a.onNext(null); if (d) { Throwable ex = error; if (ex != null) { signalAsyncError(); } else { a.onComplete(); } return; } missed = WIP.addAndGet(this, -missed); if (missed == 0) { break; } } }
Example 8
Source File: UnicastProcessor.java From reactive-streams-commons with Apache License 2.0 | 5 votes |
void drainFused(Subscriber<? super T> a) { int missed = 1; final Queue<T> q = queue; for (;;) { if (cancelled) { q.clear(); actual = null; return; } boolean d = done; a.onNext(null); if (d) { actual = null; Throwable ex = error; if (ex != null) { a.onError(ex); } else { a.onComplete(); } return; } missed = WIP.addAndGet(this, -missed); if (missed == 0) { break; } } }
Example 9
Source File: ComponentUtils.java From rice with Educational Community License v2.0 | 5 votes |
/** * places a all entries from a map into each context map of a list of components * * @param components The list components. * @param sourceContext The source context map. */ public static void pushAllToContext(List<? extends Component> components, Map<String, Object> sourceContext) { if (components == null || components.isEmpty()) { return; } @SuppressWarnings("unchecked") Queue<LifecycleElement> elementQueue = RecycleUtils.getInstance( LinkedList.class); try { elementQueue.addAll(components); while (!elementQueue.isEmpty()) { LifecycleElement currentElement = elementQueue.poll(); if (currentElement == null) { continue; } if (currentElement instanceof Component) { ((Component) currentElement).pushAllToContext(sourceContext); } elementQueue.addAll(ViewLifecycleUtils.getElementsForLifecycle(currentElement).values()); } } finally { elementQueue.clear(); RecycleUtils.recycle(elementQueue); } }
Example 10
Source File: PolicyIntersector.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * Performs intersection on the input collection of policies and returns the resulting (intersected) policy. If input policy * collection contains only a single policy instance, no intersection is performed and the instance is directly returned * as a method call result. * * @param policies collection of policies to be intersected. Must not be {@code null} nor empty, otherwise exception is thrown. * @return intersected policy as a result of perfromed policy intersection. A {@code null} value is never returned. * * @throws IllegalArgumentException in case {@code policies} argument is either {@code null} or empty collection. */ public Policy intersect(final Policy... policies) { if (policies == null || policies.length == 0) { throw LOGGER.logSevereException(new IllegalArgumentException(LocalizationMessages.WSP_0056_NEITHER_NULL_NOR_EMPTY_POLICY_COLLECTION_EXPECTED())); } else if (policies.length == 1) { return policies[0]; } // check for "null" and "empty" policy: if such policy is found return "null" policy, // or if all policies are "empty", return "empty" policy boolean found = false; boolean allPoliciesEmpty = true; NamespaceVersion latestVersion = null; for (Policy tested : policies) { if (tested.isEmpty()) { found = true; } else { if (tested.isNull()) { found = true; } allPoliciesEmpty = false; } if (latestVersion == null) { latestVersion = tested.getNamespaceVersion(); } else if (latestVersion.compareTo(tested.getNamespaceVersion()) < 0) { latestVersion = tested.getNamespaceVersion(); } if (found && !allPoliciesEmpty) { return Policy.createNullPolicy(latestVersion, null, null); } } latestVersion = (latestVersion != null) ? latestVersion : NamespaceVersion.getLatestVersion(); if (allPoliciesEmpty) { return Policy.createEmptyPolicy(latestVersion, null, null); } // simple tests didn't lead to final answer => let's performe some intersecting ;) final List<AssertionSet> finalAlternatives = new LinkedList<AssertionSet>(policies[0].getContent()); final Queue<AssertionSet> testedAlternatives = new LinkedList<AssertionSet>(); final List<AssertionSet> alternativesToMerge = new ArrayList<AssertionSet>(2); for (int i = 1; i < policies.length; i++) { final Collection<AssertionSet> currentAlternatives = policies[i].getContent(); testedAlternatives.clear(); testedAlternatives.addAll(finalAlternatives); finalAlternatives.clear(); AssertionSet testedAlternative; while ((testedAlternative = testedAlternatives.poll()) != null) { for (AssertionSet currentAlternative : currentAlternatives) { if (testedAlternative.isCompatibleWith(currentAlternative, this.mode)) { alternativesToMerge.add(testedAlternative); alternativesToMerge.add(currentAlternative); finalAlternatives.add(AssertionSet.createMergedAssertionSet(alternativesToMerge)); alternativesToMerge.clear(); } } } } return Policy.createPolicy(latestVersion, null, null, finalAlternatives); }
Example 11
Source File: PolicyIntersector.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * Performs intersection on the input collection of policies and returns the resulting (intersected) policy. If input policy * collection contains only a single policy instance, no intersection is performed and the instance is directly returned * as a method call result. * * @param policies collection of policies to be intersected. Must not be {@code null} nor empty, otherwise exception is thrown. * @return intersected policy as a result of perfromed policy intersection. A {@code null} value is never returned. * * @throws IllegalArgumentException in case {@code policies} argument is either {@code null} or empty collection. */ public Policy intersect(final Policy... policies) { if (policies == null || policies.length == 0) { throw LOGGER.logSevereException(new IllegalArgumentException(LocalizationMessages.WSP_0056_NEITHER_NULL_NOR_EMPTY_POLICY_COLLECTION_EXPECTED())); } else if (policies.length == 1) { return policies[0]; } // check for "null" and "empty" policy: if such policy is found return "null" policy, // or if all policies are "empty", return "empty" policy boolean found = false; boolean allPoliciesEmpty = true; NamespaceVersion latestVersion = null; for (Policy tested : policies) { if (tested.isEmpty()) { found = true; } else { if (tested.isNull()) { found = true; } allPoliciesEmpty = false; } if (latestVersion == null) { latestVersion = tested.getNamespaceVersion(); } else if (latestVersion.compareTo(tested.getNamespaceVersion()) < 0) { latestVersion = tested.getNamespaceVersion(); } if (found && !allPoliciesEmpty) { return Policy.createNullPolicy(latestVersion, null, null); } } latestVersion = (latestVersion != null) ? latestVersion : NamespaceVersion.getLatestVersion(); if (allPoliciesEmpty) { return Policy.createEmptyPolicy(latestVersion, null, null); } // simple tests didn't lead to final answer => let's performe some intersecting ;) final List<AssertionSet> finalAlternatives = new LinkedList<AssertionSet>(policies[0].getContent()); final Queue<AssertionSet> testedAlternatives = new LinkedList<AssertionSet>(); final List<AssertionSet> alternativesToMerge = new ArrayList<AssertionSet>(2); for (int i = 1; i < policies.length; i++) { final Collection<AssertionSet> currentAlternatives = policies[i].getContent(); testedAlternatives.clear(); testedAlternatives.addAll(finalAlternatives); finalAlternatives.clear(); AssertionSet testedAlternative; while ((testedAlternative = testedAlternatives.poll()) != null) { for (AssertionSet currentAlternative : currentAlternatives) { if (testedAlternative.isCompatibleWith(currentAlternative, this.mode)) { alternativesToMerge.add(testedAlternative); alternativesToMerge.add(currentAlternative); finalAlternatives.add(AssertionSet.createMergedAssertionSet(alternativesToMerge)); alternativesToMerge.clear(); } } } } return Policy.createPolicy(latestVersion, null, null, finalAlternatives); }
Example 12
Source File: EventTimeOrderingOperatorTest.java From flink-connectors with Apache License 2.0 | 4 votes |
@Test public void testOrdering() throws Exception { Queue<Object> actual; Queue<Object> expected; // emit some out of order events for a given key. // numerous events are emitted for timestamp 2 to validate support for having // more than one event at a given timestamp. testHarness.processElement(record(K1, 1L)); testHarness.processElement(record(K1, 3L)); testHarness.processElement(record(K1, 2L)); testHarness.processElement(record(K1, 2L)); testHarness.processElement(record(K1, 4L)); // advance to timestamp 3, expecting a subset of elements to be emitted. testHarness.processWatermark(3L); actual = testHarness.getOutput(); expected = new ConcurrentLinkedQueue<>(); expected.add(record(K1, 1L)); expected.add(record(K1, 2L)); expected.add(record(K1, 2L)); expected.add(record(K1, 3L)); expected.add(watermark(3L)); TestHarnessUtil.assertOutputEquals("Unexpected output", expected, actual); actual.clear(); // advance to timestamp 4, expecting the final element to be emitted. testHarness.processWatermark(4L); actual = testHarness.getOutput(); expected = new ConcurrentLinkedQueue<>(); expected.add(record(K1, 4L)); expected.add(watermark(4L)); TestHarnessUtil.assertOutputEquals("Unexpected output", expected, actual); actual.clear(); // advance to timestamp 5, expecting no elements to be emitted. testHarness.processWatermark(5L); actual = testHarness.getOutput(); expected = new ConcurrentLinkedQueue<>(); expected.add(watermark(5L)); TestHarnessUtil.assertOutputEquals("Unexpected output", expected, actual); actual.clear(); }
Example 13
Source File: PolicyIntersector.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * Performs intersection on the input collection of policies and returns the resulting (intersected) policy. If input policy * collection contains only a single policy instance, no intersection is performed and the instance is directly returned * as a method call result. * * @param policies collection of policies to be intersected. Must not be {@code null} nor empty, otherwise exception is thrown. * @return intersected policy as a result of perfromed policy intersection. A {@code null} value is never returned. * * @throws IllegalArgumentException in case {@code policies} argument is either {@code null} or empty collection. */ public Policy intersect(final Policy... policies) { if (policies == null || policies.length == 0) { throw LOGGER.logSevereException(new IllegalArgumentException(LocalizationMessages.WSP_0056_NEITHER_NULL_NOR_EMPTY_POLICY_COLLECTION_EXPECTED())); } else if (policies.length == 1) { return policies[0]; } // check for "null" and "empty" policy: if such policy is found return "null" policy, // or if all policies are "empty", return "empty" policy boolean found = false; boolean allPoliciesEmpty = true; NamespaceVersion latestVersion = null; for (Policy tested : policies) { if (tested.isEmpty()) { found = true; } else { if (tested.isNull()) { found = true; } allPoliciesEmpty = false; } if (latestVersion == null) { latestVersion = tested.getNamespaceVersion(); } else if (latestVersion.compareTo(tested.getNamespaceVersion()) < 0) { latestVersion = tested.getNamespaceVersion(); } if (found && !allPoliciesEmpty) { return Policy.createNullPolicy(latestVersion, null, null); } } latestVersion = (latestVersion != null) ? latestVersion : NamespaceVersion.getLatestVersion(); if (allPoliciesEmpty) { return Policy.createEmptyPolicy(latestVersion, null, null); } // simple tests didn't lead to final answer => let's performe some intersecting ;) final List<AssertionSet> finalAlternatives = new LinkedList<AssertionSet>(policies[0].getContent()); final Queue<AssertionSet> testedAlternatives = new LinkedList<AssertionSet>(); final List<AssertionSet> alternativesToMerge = new ArrayList<AssertionSet>(2); for (int i = 1; i < policies.length; i++) { final Collection<AssertionSet> currentAlternatives = policies[i].getContent(); testedAlternatives.clear(); testedAlternatives.addAll(finalAlternatives); finalAlternatives.clear(); AssertionSet testedAlternative; while ((testedAlternative = testedAlternatives.poll()) != null) { for (AssertionSet currentAlternative : currentAlternatives) { if (testedAlternative.isCompatibleWith(currentAlternative, this.mode)) { alternativesToMerge.add(testedAlternative); alternativesToMerge.add(currentAlternative); finalAlternatives.add(AssertionSet.createMergedAssertionSet(alternativesToMerge)); alternativesToMerge.clear(); } } } } return Policy.createPolicy(latestVersion, null, null, finalAlternatives); }
Example 14
Source File: SingleConsumerQueueTest.java From caffeine with Apache License 2.0 | 4 votes |
@Test(dataProvider = "populated") public void clear_whenPopulated(Queue<?> queue) { queue.clear(); assertThat(queue, is(deeplyEmpty())); }
Example 15
Source File: PolicyIntersector.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * Performs intersection on the input collection of policies and returns the resulting (intersected) policy. If input policy * collection contains only a single policy instance, no intersection is performed and the instance is directly returned * as a method call result. * * @param policies collection of policies to be intersected. Must not be {@code null} nor empty, otherwise exception is thrown. * @return intersected policy as a result of perfromed policy intersection. A {@code null} value is never returned. * * @throws IllegalArgumentException in case {@code policies} argument is either {@code null} or empty collection. */ public Policy intersect(final Policy... policies) { if (policies == null || policies.length == 0) { throw LOGGER.logSevereException(new IllegalArgumentException(LocalizationMessages.WSP_0056_NEITHER_NULL_NOR_EMPTY_POLICY_COLLECTION_EXPECTED())); } else if (policies.length == 1) { return policies[0]; } // check for "null" and "empty" policy: if such policy is found return "null" policy, // or if all policies are "empty", return "empty" policy boolean found = false; boolean allPoliciesEmpty = true; NamespaceVersion latestVersion = null; for (Policy tested : policies) { if (tested.isEmpty()) { found = true; } else { if (tested.isNull()) { found = true; } allPoliciesEmpty = false; } if (latestVersion == null) { latestVersion = tested.getNamespaceVersion(); } else if (latestVersion.compareTo(tested.getNamespaceVersion()) < 0) { latestVersion = tested.getNamespaceVersion(); } if (found && !allPoliciesEmpty) { return Policy.createNullPolicy(latestVersion, null, null); } } latestVersion = (latestVersion != null) ? latestVersion : NamespaceVersion.getLatestVersion(); if (allPoliciesEmpty) { return Policy.createEmptyPolicy(latestVersion, null, null); } // simple tests didn't lead to final answer => let's performe some intersecting ;) final List<AssertionSet> finalAlternatives = new LinkedList<AssertionSet>(policies[0].getContent()); final Queue<AssertionSet> testedAlternatives = new LinkedList<AssertionSet>(); final List<AssertionSet> alternativesToMerge = new ArrayList<AssertionSet>(2); for (int i = 1; i < policies.length; i++) { final Collection<AssertionSet> currentAlternatives = policies[i].getContent(); testedAlternatives.clear(); testedAlternatives.addAll(finalAlternatives); finalAlternatives.clear(); AssertionSet testedAlternative; while ((testedAlternative = testedAlternatives.poll()) != null) { for (AssertionSet currentAlternative : currentAlternatives) { if (testedAlternative.isCompatibleWith(currentAlternative, this.mode)) { alternativesToMerge.add(testedAlternative); alternativesToMerge.add(currentAlternative); finalAlternatives.add(AssertionSet.createMergedAssertionSet(alternativesToMerge)); alternativesToMerge.clear(); } } } } return Policy.createPolicy(latestVersion, null, null, finalAlternatives); }
Example 16
Source File: PolicyIntersector.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * Performs intersection on the input collection of policies and returns the resulting (intersected) policy. If input policy * collection contains only a single policy instance, no intersection is performed and the instance is directly returned * as a method call result. * * @param policies collection of policies to be intersected. Must not be {@code null} nor empty, otherwise exception is thrown. * @return intersected policy as a result of perfromed policy intersection. A {@code null} value is never returned. * * @throws IllegalArgumentException in case {@code policies} argument is either {@code null} or empty collection. */ public Policy intersect(final Policy... policies) { if (policies == null || policies.length == 0) { throw LOGGER.logSevereException(new IllegalArgumentException(LocalizationMessages.WSP_0056_NEITHER_NULL_NOR_EMPTY_POLICY_COLLECTION_EXPECTED())); } else if (policies.length == 1) { return policies[0]; } // check for "null" and "empty" policy: if such policy is found return "null" policy, // or if all policies are "empty", return "empty" policy boolean found = false; boolean allPoliciesEmpty = true; NamespaceVersion latestVersion = null; for (Policy tested : policies) { if (tested.isEmpty()) { found = true; } else { if (tested.isNull()) { found = true; } allPoliciesEmpty = false; } if (latestVersion == null) { latestVersion = tested.getNamespaceVersion(); } else if (latestVersion.compareTo(tested.getNamespaceVersion()) < 0) { latestVersion = tested.getNamespaceVersion(); } if (found && !allPoliciesEmpty) { return Policy.createNullPolicy(latestVersion, null, null); } } latestVersion = (latestVersion != null) ? latestVersion : NamespaceVersion.getLatestVersion(); if (allPoliciesEmpty) { return Policy.createEmptyPolicy(latestVersion, null, null); } // simple tests didn't lead to final answer => let's performe some intersecting ;) final List<AssertionSet> finalAlternatives = new LinkedList<AssertionSet>(policies[0].getContent()); final Queue<AssertionSet> testedAlternatives = new LinkedList<AssertionSet>(); final List<AssertionSet> alternativesToMerge = new ArrayList<AssertionSet>(2); for (int i = 1; i < policies.length; i++) { final Collection<AssertionSet> currentAlternatives = policies[i].getContent(); testedAlternatives.clear(); testedAlternatives.addAll(finalAlternatives); finalAlternatives.clear(); AssertionSet testedAlternative; while ((testedAlternative = testedAlternatives.poll()) != null) { for (AssertionSet currentAlternative : currentAlternatives) { if (testedAlternative.isCompatibleWith(currentAlternative, this.mode)) { alternativesToMerge.add(testedAlternative); alternativesToMerge.add(currentAlternative); finalAlternatives.add(AssertionSet.createMergedAssertionSet(alternativesToMerge)); alternativesToMerge.clear(); } } } } return Policy.createPolicy(latestVersion, null, null, finalAlternatives); }
Example 17
Source File: ComponentUtils.java From rice with Educational Community License v2.0 | 4 votes |
/** * Traverse a component tree, setting a property on all components for which the property is writable. * * @param <T> component type * @param <T> component type * @param components The components to traverse. * @param propertyPath The property path to set. * @param propertyValue The property value to set. * @see ObjectPropertyUtils#isWritableProperty(Object, String) * @see ObjectPropertyUtils#setPropertyValue(Object, String, Object) */ public static <T extends Component> void setComponentsPropertyDeep(List<T> components, String propertyPath, Object propertyValue) { if (components == null || components.isEmpty()) { return; } Set<Class<?>> skipTypes = null; @SuppressWarnings("unchecked") Queue<LifecycleElement> elementQueue = RecycleUtils.getInstance( LinkedList.class); elementQueue.addAll(components); try { while (!elementQueue.isEmpty()) { LifecycleElement currentElement = elementQueue.poll(); if (currentElement == null) { continue; } elementQueue.addAll(ViewLifecycleUtils.getElementsForLifecycle(currentElement).values()); Class<?> componentClass = currentElement.getClass(); if (skipTypes != null && skipTypes.contains(componentClass)) { continue; } if (!ObjectPropertyUtils.isWritableProperty(currentElement, propertyPath)) { if (skipTypes == null) { skipTypes = new HashSet<Class<?>>(); } skipTypes.add(componentClass); continue; } ObjectPropertyUtils.setPropertyValue(currentElement, propertyPath, propertyValue, true); } } finally { elementQueue.clear(); RecycleUtils.recycle(elementQueue); } }
Example 18
Source File: MultiWindowOnDurationOp.java From smallrye-mutiny with Apache License 2.0 | 4 votes |
@SuppressWarnings("unchecked") void drainLoop() { final Queue<Object> q = queue; final MultiSubscriber<? super Multi<T>> actual = downstream; UnicastProcessor<T> processor = current; int missed = 1; for (;;) { for (;;) { if (terminated) { super.cancel(); q.clear(); timer.cancel(); return; } boolean d = done; Object o = q.poll(); boolean empty = o == null; boolean isTick = o instanceof WindowTimeoutSubscriber.Tick; if (d && (empty || isTick)) { current = null; q.clear(); Throwable err = failure; if (err != null) { processor.onError(err); } else { processor.onComplete(); } timer.cancel(); return; } if (empty) { break; } if (isTick) { processor.onComplete(); processor = UnicastProcessor.create(); current = processor; long requests = requested.get(); if (requests != 0L) { actual.onItem(processor); if (requests != Long.MAX_VALUE) { requested.decrementAndGet(); } } else { current = null; queue.clear(); actual.onError(new BackPressureFailure("no requests")); timer.cancel(); return; } continue; } processor.onNext((T) o); } missed = wip.addAndGet(-missed); if (missed == 0) { break; } } }
Example 19
Source File: FluxSwitchMap.java From reactor-core with Apache License 2.0 | 3 votes |
void cancelAndCleanup(Queue<?> q) { s.cancel(); cancelInner(); q.clear(); }
Example 20
Source File: RandomForestTrainer.java From ignite with Apache License 2.0 | 2 votes |
/** * Default nodesToLearnSelectionStrategy that returns all nodes from queue. * * @param queue Queue. * @return List of nodes to learn. */ private List<TreeNode> defaultNodesToLearnSelectionStrgy(Queue<TreeNode> queue) { List<TreeNode> res = new ArrayList<>(queue); queue.clear(); return res; }