java.util.ArrayDeque

Here are the examples of the java api class java.util.ArrayDeque taken from open source projects.

1. ArrayDequeTest#testIteratorOrdering()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * Iterator ordering is FIFO
     */
public void testIteratorOrdering() {
    final ArrayDeque q = new ArrayDeque();
    q.add(one);
    q.add(two);
    q.add(three);
    int k = 0;
    for (Iterator it = q.iterator(); it.hasNext(); ) {
        assertEquals(++k, it.next());
    }
    assertEquals(3, k);
}

2. ArrayDequeTest#testIteratorOrdering()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * Iterator ordering is FIFO
     */
public void testIteratorOrdering() {
    final ArrayDeque q = new ArrayDeque();
    q.add(one);
    q.add(two);
    q.add(three);
    int k = 0;
    for (Iterator it = q.iterator(); it.hasNext(); ) {
        assertEquals(++k, it.next());
    }
    assertEquals(3, k);
}

3. FindIndirectParamsVisitor#exec()

View license
@Override
public IndirectParamsInfo exec(SoyNode node) {
    Preconditions.checkArgument(node instanceof TemplateNode);
    isStartOfPass = true;
    visitedCallSituations = Sets.newHashSet();
    currTemplate = null;
    callerStack = new ArrayDeque<>();
    callerStack.add(new CallerFrame(null, ImmutableSet.<TemplateNode>of(), ImmutableSet.<String>of()));
    indirectParams = Maps.newHashMap();
    paramKeyToCalleesMultimap = HashMultimap.create();
    indirectParamTypes = HashMultimap.create();
    mayHaveIndirectParamsInExternalCalls = false;
    mayHaveIndirectParamsInExternalDelCalls = false;
    visit(node);
    return new IndirectParamsInfo(ImmutableSortedMap.copyOf(indirectParams), paramKeyToCalleesMultimap, ImmutableMultimap.copyOf(indirectParamTypes), mayHaveIndirectParamsInExternalCalls, mayHaveIndirectParamsInExternalDelCalls);
}

4. TestIndexHelper#setUp()

Project: esper
Source File: TestIndexHelper.java
View license
public void setUp() {
    eventType = SupportEventTypeFactory.createBeanType(SupportBean.class);
    parameters = new ArrayDeque<FilterValueSetParam>();
    // Create parameter test list
    parameterOne = new FilterValueSetParamImpl(makeLookupable("intPrimitive"), FilterOperator.GREATER, 10);
    parameters.add(parameterOne);
    parameterTwo = new FilterValueSetParamImpl(makeLookupable("doubleBoxed"), FilterOperator.GREATER, 20d);
    parameters.add(parameterTwo);
    parameterThree = new FilterValueSetParamImpl(makeLookupable("string"), FilterOperator.EQUAL, "sometext");
    parameters.add(parameterThree);
}

5. ByteBufferFifo#setBigEndian()

Project: h-store
Source File: ByteBufferFifo.java
View license
// TODO: This is a hack. Make a proper setByteOrder method?
public void setBigEndian() {
    assert !bigEndian;
    bigEndian = true;
    @SuppressWarnings("rawtypes") ArrayDeque[] collections = { emptyBuffers, readBuffers };
    for (ArrayDeque<ByteBuffer> collection : collections) {
        for (ByteBuffer buffer : collection) {
            buffer.order(ByteOrder.BIG_ENDIAN);
        }
    }
    if (currentWrite != null) {
        currentWrite.order(ByteOrder.BIG_ENDIAN);
    }
}

6. ArrayDequeTest#testRemoveElement()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * remove(x) removes x and returns true if present
     */
public void testRemoveElement() {
    ArrayDeque q = populatedDeque(SIZE);
    for (int i = 1; i < SIZE; i += 2) {
        assertTrue(q.contains(i));
        assertTrue(q.remove(i));
        assertFalse(q.contains(i));
        assertTrue(q.contains(i - 1));
    }
    for (int i = 0; i < SIZE; i += 2) {
        assertTrue(q.contains(i));
        assertTrue(q.remove(i));
        assertFalse(q.contains(i));
        assertFalse(q.remove(i + 1));
        assertFalse(q.contains(i + 1));
    }
    assertTrue(q.isEmpty());
}

7. ArrayDequeTest#testLastElement()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * getLast() returns last element, or throws NSEE if empty
     */
public void testLastElement() {
    ArrayDeque q = populatedDeque(SIZE);
    for (int i = SIZE - 1; i >= 0; --i) {
        assertEquals(i, q.getLast());
        assertEquals(i, q.pollLast());
    }
    try {
        q.getLast();
        shouldThrow();
    } catch (NoSuchElementException success) {
    }
    assertNull(q.peekLast());
}

8. ArrayDequeTest#testToArray()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * toArray() contains all elements in FIFO order
     */
public void testToArray() {
    ArrayDeque q = new ArrayDeque();
    for (int i = 0; i < SIZE; i++) {
        checkToArray(q);
        q.addLast(i);
    }
    // Provoke wraparound
    for (int i = 0; i < SIZE; i++) {
        checkToArray(q);
        assertEquals(i, q.poll());
        q.addLast(SIZE + i);
    }
    for (int i = 0; i < SIZE; i++) {
        checkToArray(q);
        assertEquals(SIZE + i, q.poll());
    }
}

9. ArrayDequeTest#testToArray2()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * toArray(a) contains all elements in FIFO order
     */
public void testToArray2() {
    ArrayDeque q = new ArrayDeque();
    for (int i = 0; i < SIZE; i++) {
        checkToArray2(q);
        q.addLast(i);
    }
    // Provoke wraparound
    for (int i = 0; i < SIZE; i++) {
        checkToArray2(q);
        assertEquals(i, q.poll());
        q.addLast(SIZE + i);
    }
    for (int i = 0; i < SIZE; i++) {
        checkToArray2(q);
        assertEquals(SIZE + i, q.poll());
    }
}

10. ArrayDequeTest#testIteratorRemove()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * iterator.remove() removes current element
     */
public void testIteratorRemove() {
    final ArrayDeque q = new ArrayDeque();
    final Random rng = new Random();
    for (int iters = 0; iters < 100; ++iters) {
        int max = rng.nextInt(5) + 2;
        int split = rng.nextInt(max - 1) + 1;
        for (int j = 1; j <= max; ++j) q.add(new Integer(j));
        Iterator it = q.iterator();
        for (int j = 1; j <= split; ++j) assertEquals(it.next(), new Integer(j));
        it.remove();
        assertEquals(it.next(), new Integer(split + 1));
        for (int j = 1; j <= split; ++j) q.remove(new Integer(j));
        it = q.iterator();
        for (int j = split + 1; j <= max; ++j) {
            assertEquals(it.next(), new Integer(j));
            it.remove();
        }
        assertFalse(it.hasNext());
        assertTrue(q.isEmpty());
    }
}

11. ArrayDequeTest#testDescendingIterator()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * Descending iterator iterates through all elements
     */
public void testDescendingIterator() {
    ArrayDeque q = populatedDeque(SIZE);
    int i = 0;
    Iterator it = q.descendingIterator();
    while (it.hasNext()) {
        assertTrue(q.contains(it.next()));
        ++i;
    }
    assertEquals(i, SIZE);
    assertFalse(it.hasNext());
    try {
        it.next();
        shouldThrow();
    } catch (NoSuchElementException success) {
    }
}

12. ArrayDequeTest#testDescendingIteratorOrdering()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * Descending iterator ordering is reverse FIFO
     */
public void testDescendingIteratorOrdering() {
    final ArrayDeque q = new ArrayDeque();
    for (int iters = 0; iters < 100; ++iters) {
        q.add(new Integer(3));
        q.add(new Integer(2));
        q.add(new Integer(1));
        int k = 0;
        for (Iterator it = q.descendingIterator(); it.hasNext(); ) {
            assertEquals(++k, it.next());
        }
        assertEquals(3, k);
        q.remove();
        q.remove();
        q.remove();
    }
}

13. ArrayDequeTest#testDescendingIteratorRemove()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * descendingIterator.remove() removes current element
     */
public void testDescendingIteratorRemove() {
    final ArrayDeque q = new ArrayDeque();
    final Random rng = new Random();
    for (int iters = 0; iters < 100; ++iters) {
        int max = rng.nextInt(5) + 2;
        int split = rng.nextInt(max - 1) + 1;
        for (int j = max; j >= 1; --j) q.add(new Integer(j));
        Iterator it = q.descendingIterator();
        for (int j = 1; j <= split; ++j) assertEquals(it.next(), new Integer(j));
        it.remove();
        assertEquals(it.next(), new Integer(split + 1));
        for (int j = 1; j <= split; ++j) q.remove(new Integer(j));
        it = q.descendingIterator();
        for (int j = split + 1; j <= max; ++j) {
            assertEquals(it.next(), new Integer(j));
            it.remove();
        }
        assertFalse(it.hasNext());
        assertTrue(q.isEmpty());
    }
}

14. ArrayDequeTest#testRemoveElement()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * remove(x) removes x and returns true if present
     */
public void testRemoveElement() {
    ArrayDeque q = populatedDeque(SIZE);
    for (int i = 1; i < SIZE; i += 2) {
        assertTrue(q.contains(i));
        assertTrue(q.remove(i));
        assertFalse(q.contains(i));
        assertTrue(q.contains(i - 1));
    }
    for (int i = 0; i < SIZE; i += 2) {
        assertTrue(q.contains(i));
        assertTrue(q.remove(i));
        assertFalse(q.contains(i));
        assertFalse(q.remove(i + 1));
        assertFalse(q.contains(i + 1));
    }
    assertTrue(q.isEmpty());
}

15. ArrayDequeTest#testLastElement()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * getLast() returns last element, or throws NSEE if empty
     */
public void testLastElement() {
    ArrayDeque q = populatedDeque(SIZE);
    for (int i = SIZE - 1; i >= 0; --i) {
        assertEquals(i, q.getLast());
        assertEquals(i, q.pollLast());
    }
    try {
        q.getLast();
        shouldThrow();
    } catch (NoSuchElementException success) {
    }
    assertNull(q.peekLast());
}

16. ArrayDequeTest#testToArray()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * toArray() contains all elements in FIFO order
     */
public void testToArray() {
    ArrayDeque q = new ArrayDeque();
    for (int i = 0; i < SIZE; i++) {
        checkToArray(q);
        q.addLast(i);
    }
    // Provoke wraparound
    for (int i = 0; i < SIZE; i++) {
        checkToArray(q);
        assertEquals(i, q.poll());
        q.addLast(SIZE + i);
    }
    for (int i = 0; i < SIZE; i++) {
        checkToArray(q);
        assertEquals(SIZE + i, q.poll());
    }
}

17. ArrayDequeTest#testToArray2()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * toArray(a) contains all elements in FIFO order
     */
public void testToArray2() {
    ArrayDeque q = new ArrayDeque();
    for (int i = 0; i < SIZE; i++) {
        checkToArray2(q);
        q.addLast(i);
    }
    // Provoke wraparound
    for (int i = 0; i < SIZE; i++) {
        checkToArray2(q);
        assertEquals(i, q.poll());
        q.addLast(SIZE + i);
    }
    for (int i = 0; i < SIZE; i++) {
        checkToArray2(q);
        assertEquals(SIZE + i, q.poll());
    }
}

18. ArrayDequeTest#testIteratorRemove()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * iterator.remove() removes current element
     */
public void testIteratorRemove() {
    final ArrayDeque q = new ArrayDeque();
    final Random rng = new Random();
    for (int iters = 0; iters < 100; ++iters) {
        int max = rng.nextInt(5) + 2;
        int split = rng.nextInt(max - 1) + 1;
        for (int j = 1; j <= max; ++j) q.add(new Integer(j));
        Iterator it = q.iterator();
        for (int j = 1; j <= split; ++j) assertEquals(it.next(), new Integer(j));
        it.remove();
        assertEquals(it.next(), new Integer(split + 1));
        for (int j = 1; j <= split; ++j) q.remove(new Integer(j));
        it = q.iterator();
        for (int j = split + 1; j <= max; ++j) {
            assertEquals(it.next(), new Integer(j));
            it.remove();
        }
        assertFalse(it.hasNext());
        assertTrue(q.isEmpty());
    }
}

19. ArrayDequeTest#testDescendingIterator()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * Descending iterator iterates through all elements
     */
public void testDescendingIterator() {
    ArrayDeque q = populatedDeque(SIZE);
    int i = 0;
    Iterator it = q.descendingIterator();
    while (it.hasNext()) {
        assertTrue(q.contains(it.next()));
        ++i;
    }
    assertEquals(i, SIZE);
    assertFalse(it.hasNext());
    try {
        it.next();
        shouldThrow();
    } catch (NoSuchElementException success) {
    }
}

20. ArrayDequeTest#testDescendingIteratorOrdering()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * Descending iterator ordering is reverse FIFO
     */
public void testDescendingIteratorOrdering() {
    final ArrayDeque q = new ArrayDeque();
    for (int iters = 0; iters < 100; ++iters) {
        q.add(new Integer(3));
        q.add(new Integer(2));
        q.add(new Integer(1));
        int k = 0;
        for (Iterator it = q.descendingIterator(); it.hasNext(); ) {
            assertEquals(++k, it.next());
        }
        assertEquals(3, k);
        q.remove();
        q.remove();
        q.remove();
    }
}

21. ArrayDequeTest#testDescendingIteratorRemove()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * descendingIterator.remove() removes current element
     */
public void testDescendingIteratorRemove() {
    final ArrayDeque q = new ArrayDeque();
    final Random rng = new Random();
    for (int iters = 0; iters < 100; ++iters) {
        int max = rng.nextInt(5) + 2;
        int split = rng.nextInt(max - 1) + 1;
        for (int j = max; j >= 1; --j) q.add(new Integer(j));
        Iterator it = q.descendingIterator();
        for (int j = 1; j <= split; ++j) assertEquals(it.next(), new Integer(j));
        it.remove();
        assertEquals(it.next(), new Integer(split + 1));
        for (int j = 1; j <= split; ++j) q.remove(new Integer(j));
        it = q.descendingIterator();
        for (int j = split + 1; j <= max; ++j) {
            assertEquals(it.next(), new Integer(j));
            it.remove();
        }
        assertFalse(it.hasNext());
        assertTrue(q.isEmpty());
    }
}

22. ArrayDequeTest#testEmpty()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * isEmpty is true before add, false after
     */
public void testEmpty() {
    ArrayDeque q = new ArrayDeque();
    assertTrue(q.isEmpty());
    q.add(new Integer(1));
    assertFalse(q.isEmpty());
    q.add(new Integer(2));
    q.removeFirst();
    q.removeFirst();
    assertTrue(q.isEmpty());
}

23. ArrayDequeTest#testEmpty()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * isEmpty is true before add, false after
     */
public void testEmpty() {
    ArrayDeque q = new ArrayDeque();
    assertTrue(q.isEmpty());
    q.add(new Integer(1));
    assertFalse(q.isEmpty());
    q.add(new Integer(2));
    q.removeFirst();
    q.removeFirst();
    assertTrue(q.isEmpty());
}

24. ArrayDequeTest#testPush()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * peekFirst() returns element inserted with push
     */
public void testPush() {
    ArrayDeque q = populatedDeque(3);
    q.pollLast();
    q.push(four);
    assertSame(four, q.peekFirst());
}

25. ArrayDequeTest#testAddFirst()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * addFirst(x) succeeds
     */
public void testAddFirst() {
    ArrayDeque q = new ArrayDeque();
    q.addFirst(zero);
    q.addFirst(one);
    assertSame(one, q.peekFirst());
    assertSame(zero, q.peekLast());
}

26. ArrayDequeTest#testAddLast()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * addLast(x) succeeds
     */
public void testAddLast() {
    ArrayDeque q = new ArrayDeque();
    q.addLast(zero);
    q.addLast(one);
    assertSame(zero, q.peekFirst());
    assertSame(one, q.peekLast());
}

27. ArrayDequeTest#testClear()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * clear removes all elements
     */
public void testClear() {
    ArrayDeque q = populatedDeque(SIZE);
    q.clear();
    assertTrue(q.isEmpty());
    assertEquals(0, q.size());
    assertTrue(q.add(new Integer(1)));
    assertFalse(q.isEmpty());
    q.clear();
    assertTrue(q.isEmpty());
}

28. ArrayDequeTest#testPush()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * peekFirst() returns element inserted with push
     */
public void testPush() {
    ArrayDeque q = populatedDeque(3);
    q.pollLast();
    q.push(four);
    assertSame(four, q.peekFirst());
}

29. ArrayDequeTest#testAddFirst()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * addFirst(x) succeeds
     */
public void testAddFirst() {
    ArrayDeque q = new ArrayDeque();
    q.addFirst(zero);
    q.addFirst(one);
    assertSame(one, q.peekFirst());
    assertSame(zero, q.peekLast());
}

30. ArrayDequeTest#testAddLast()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * addLast(x) succeeds
     */
public void testAddLast() {
    ArrayDeque q = new ArrayDeque();
    q.addLast(zero);
    q.addLast(one);
    assertSame(zero, q.peekFirst());
    assertSame(one, q.peekLast());
}

31. ArrayDequeTest#testClear()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * clear removes all elements
     */
public void testClear() {
    ArrayDeque q = populatedDeque(SIZE);
    q.clear();
    assertTrue(q.isEmpty());
    assertEquals(0, q.size());
    assertTrue(q.add(new Integer(1)));
    assertFalse(q.isEmpty());
    q.clear();
    assertTrue(q.isEmpty());
}

32. MapMarshaller#initTransients()

Project: Chronicle-Map
Source File: MapMarshaller.java
View license
private void initTransients() {
    orderedKeys = new ArrayDeque<>();
    orderedValues = new ArrayDeque<>();
}

33. ArrayDequeTest#testContainsAll()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * containsAll(c) is true when c contains a subset of elements
     */
public void testContainsAll() {
    ArrayDeque q = populatedDeque(SIZE);
    ArrayDeque p = new ArrayDeque();
    for (int i = 0; i < SIZE; ++i) {
        assertTrue(q.containsAll(p));
        assertFalse(p.containsAll(q));
        assertTrue(p.add(new Integer(i)));
    }
    assertTrue(p.containsAll(q));
}

34. ArrayDequeTest#testRetainAll()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * retainAll(c) retains only those elements of c and reports true if changed
     */
public void testRetainAll() {
    ArrayDeque q = populatedDeque(SIZE);
    ArrayDeque p = populatedDeque(SIZE);
    for (int i = 0; i < SIZE; ++i) {
        boolean changed = q.retainAll(p);
        assertEquals(changed, (i > 0));
        assertTrue(q.containsAll(p));
        assertEquals(SIZE - i, q.size());
        p.removeFirst();
    }
}

35. ArrayDequeTest#testToArray_NullArg()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * toArray(null) throws NullPointerException
     */
public void testToArray_NullArg() {
    ArrayDeque l = new ArrayDeque();
    l.add(new Object());
    try {
        l.toArray(null);
        shouldThrow();
    } catch (NullPointerException success) {
    }
}

36. ArrayDequeTest#testToArray1_BadArg()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * toArray(incompatible array type) throws ArrayStoreException
     */
public void testToArray1_BadArg() {
    ArrayDeque l = new ArrayDeque();
    l.add(new Integer(5));
    try {
        l.toArray(new String[10]);
        shouldThrow();
    } catch (ArrayStoreException success) {
    }
}

37. ArrayDequeTest#testContainsAll()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * containsAll(c) is true when c contains a subset of elements
     */
public void testContainsAll() {
    ArrayDeque q = populatedDeque(SIZE);
    ArrayDeque p = new ArrayDeque();
    for (int i = 0; i < SIZE; ++i) {
        assertTrue(q.containsAll(p));
        assertFalse(p.containsAll(q));
        assertTrue(p.add(new Integer(i)));
    }
    assertTrue(p.containsAll(q));
}

38. ArrayDequeTest#testRetainAll()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * retainAll(c) retains only those elements of c and reports true if changed
     */
public void testRetainAll() {
    ArrayDeque q = populatedDeque(SIZE);
    ArrayDeque p = populatedDeque(SIZE);
    for (int i = 0; i < SIZE; ++i) {
        boolean changed = q.retainAll(p);
        assertEquals(changed, (i > 0));
        assertTrue(q.containsAll(p));
        assertEquals(SIZE - i, q.size());
        p.removeFirst();
    }
}

39. ArrayDequeTest#testToArray_NullArg()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * toArray(null) throws NullPointerException
     */
public void testToArray_NullArg() {
    ArrayDeque l = new ArrayDeque();
    l.add(new Object());
    try {
        l.toArray(null);
        shouldThrow();
    } catch (NullPointerException success) {
    }
}

40. ArrayDequeTest#testToArray1_BadArg()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * toArray(incompatible array type) throws ArrayStoreException
     */
public void testToArray1_BadArg() {
    ArrayDeque l = new ArrayDeque();
    l.add(new Integer(5));
    try {
        l.toArray(new String[10]);
        shouldThrow();
    } catch (ArrayStoreException success) {
    }
}

41. PackageProgressReceiver#reset()

Project: bazel
Source File: PackageProgressReceiver.java
View license
/**
   * Reset all instance variables of this object to a state equal to that of a newly
   * constructed object.
   */
public synchronized void reset() {
    packagesCompleted = 0;
    pending = new ArrayDeque<>();
}

42. FinalClassCheck#beginTree()

Project: checkstyle
Source File: FinalClassCheck.java
View license
@Override
public void beginTree(DetailAST rootAST) {
    classes = new ArrayDeque<>();
    packageName = "";
}

43. JavaNCSSCheck#beginTree()

Project: checkstyle
Source File: JavaNCSSCheck.java
View license
@Override
public void beginTree(DetailAST rootAST) {
    counters = new ArrayDeque<>();
    //add a counter for the file
    counters.push(new Counter());
}

44. SetMarshaller#initTransients()

Project: Chronicle-Map
Source File: SetMarshaller.java
View license
private void initTransients() {
    orderedElements = new ArrayDeque<>();
}

45. GenJsCodeVisitor#visitTemplateNode()

View license
/**
   * Outputs a {@link TemplateNode}, generating the function open and close, along with a a debug
   * template name.
   *
   * <p>If aliasing is not performed (which is always the case for V1 templates), this looks like:
   * <pre>
   * my.namespace.func = function(opt_data, opt_sb) {
   *   ...
   * };
   * if (goog.DEBUG) {
   *   my.namespace.func.soyTemplateName = 'my.namespace.func';
   * }
   * </pre>
   *
   * <p>If aliasing is performed, this looks like:
   * <pre>
   * function $func(opt_data, opt_sb) {
   *   ...
   * }
   * exports.func = $func;
   * if (goog.DEBUG) {
   *   $func.soyTemplateName = 'my.namespace.func';
   * }
   * <p>Note that the alias is not exactly the function name as in may conflict with a reserved
   * JavaScript identifier.
   * </pre>
   */
@Override
protected void visitTemplateNode(TemplateNode node) {
    boolean useStrongTyping = hasStrictParams(node);
    String templateName = node.getTemplateName();
    String partialName = node.getPartialTemplateName();
    String alias;
    boolean addToExports = jsSrcOptions.shouldGenerateGoogModules();
    if (addToExports && node instanceof TemplateDelegateNode) {
        alias = node.getPartialTemplateName().substring(1);
    } else {
        alias = templateAliases.get(templateName);
    }
    localVarTranslations = new ArrayDeque<>();
    genJsExprsVisitor = genJsExprsVisitorFactory.create(localVarTranslations, templateAliases, errorReporter);
    assistantForMsgs = null;
    // ------ Generate JS Doc. ------
    if (jsSrcOptions.shouldGenerateJsdoc()) {
        jsCodeBuilder.appendLine("/**");
        if (useStrongTyping) {
            genParamsRecordType(node);
        } else {
            jsCodeBuilder.appendLine(" * @param {Object<string, *>=} opt_data");
        }
        jsCodeBuilder.appendLine(" * @param {(null|undefined)=} opt_ignored");
        jsCodeBuilder.appendLine(" * @param {Object<string, *>=} opt_ijData");
        String returnType = getTemplateReturnType(node);
        jsCodeBuilder.appendLine(" * @return {", returnType, "}");
        String suppressions = "checkTypes";
        jsCodeBuilder.appendLine(" * @suppress {" + suppressions + "}");
        if (node.getVisibility() == Visibility.PRIVATE) {
            jsCodeBuilder.appendLine(" * @private");
        }
        jsCodeBuilder.appendLine(" */");
    }
    // ------ Generate function definition up to opening brace. ------
    if (addToExports) {
        jsCodeBuilder.appendLine("function ", alias, "(opt_data, opt_ignored, opt_ijData) {");
    } else {
        jsCodeBuilder.appendLine(alias, " = function(opt_data, opt_ignored, opt_ijData) {");
    }
    jsCodeBuilder.increaseIndent();
    // additional temporary variable.
    if (!SoytreeUtils.getAllNodesOfType(node, NullCoalescingOpNode.class).isEmpty() || !SoytreeUtils.getAllNodesOfType(node, SwitchNode.class).isEmpty()) {
        jsCodeBuilder.appendLine("var $$temp;");
    }
    // Generate statement to ensure data is defined, if necessary.
    if (new ShouldEnsureDataIsDefinedVisitor().exec(node)) {
        jsCodeBuilder.appendLine("opt_data = opt_data || {};");
    }
    if (shouldEnsureIjDataIsDefined(node)) {
        jsCodeBuilder.appendLine("opt_ijData = opt_ijData || {};");
    }
    // ------ Generate function body. ------
    generateFunctionBody(node);
    // ------ Generate function closing brace and add to exports if necessary. ------
    jsCodeBuilder.decreaseIndent();
    if (addToExports) {
        jsCodeBuilder.appendLine("}");
        jsCodeBuilder.appendLine("exports.", partialName.substring(1), " = ", alias, ";");
    } else {
        jsCodeBuilder.appendLine("};");
    }
    // ------ Add the fully qualified template name to the function to use in debug code. ------
    jsCodeBuilder.appendLine("if (goog.DEBUG) {");
    jsCodeBuilder.increaseIndent();
    jsCodeBuilder.appendLine(alias + ".soyTemplateName = '" + templateName + "';");
    jsCodeBuilder.decreaseIndent();
    jsCodeBuilder.appendLine("}");
    // ------ If delegate template, generate a statement to register it. ------
    if (node instanceof TemplateDelegateNode) {
        TemplateDelegateNode nodeAsDelTemplate = (TemplateDelegateNode) node;
        String delTemplateIdExprText = "soy.$$getDelTemplateId('" + delTemplateNamer.getDelegateName(nodeAsDelTemplate) + "')";
        String delTemplateVariantExprText = "'" + nodeAsDelTemplate.getDelTemplateVariant() + "'";
        jsCodeBuilder.appendLine("soy.$$registerDelegateFn(", delTemplateIdExprText, ", ", delTemplateVariantExprText, ", ", nodeAsDelTemplate.getDelPriority().toString(), ", ", alias, ");");
    }
}

46. BuildAllDependeesMapVisitor#visitTemplateNode()

View license
@Override
protected void visitTemplateNode(TemplateNode node) {
    potentialDependeeFrames = new ArrayDeque<>();
    // Note: Add to potential dependees while visiting children because descendents can't be moved
    // out of the template.
    potentialDependeeFrames.push(Lists.<SoyNode>newArrayList(node));
    visitChildren(node);
    potentialDependeeFrames.pop();
}

47. FindTransitiveDepTemplatesVisitor#exec()

View license
/**
   * {@inheritDoc}
   *
   * <p> Note: This method is not thread-safe. If you need to get transitive dep templates info in a
   * thread-safe manner, then please use {@link #execOnAllTemplates}() in a thread-safe manner.
   */
@Override
public TransitiveDepTemplatesInfo exec(SoyNode rootTemplate) {
    Preconditions.checkArgument(rootTemplate instanceof TemplateNode);
    TemplateNode rootTemplateCast = (TemplateNode) rootTemplate;
    // If finished in a previous pass (previous call to exec), just return the finished info.
    if (templateToFinishedInfoMap.containsKey(rootTemplateCast)) {
        return templateToFinishedInfoMap.get(rootTemplateCast);
    }
    // Initialize vars for the pass.
    currTemplateVisitInfo = null;
    activeTemplateVisitInfoStack = new ArrayDeque<>();
    activeTemplateSet = Sets.newHashSet();
    visitedTemplateToInfoMap = Maps.newHashMap();
    visit(rootTemplateCast);
    if (!activeTemplateVisitInfoStack.isEmpty() || !activeTemplateSet.isEmpty()) {
        throw new AssertionError();
    }
    // Convert visit info to finished info for all visited templates.
    for (TemplateVisitInfo templateVisitInfo : visitedTemplateToInfoMap.values()) {
        templateToFinishedInfoMap.put(templateVisitInfo.rootTemplate, templateVisitInfo.toFinishedInfo());
    }
    return templateToFinishedInfoMap.get(rootTemplateCast);
}

48. ExceptionStackEvent#setCauseElements()

Project: deltaspike
Source File: ExceptionStackEvent.java
View license
/**
     * Internal only.
     *
     * @param elements new stack.
     */
public void setCauseElements(Collection<Throwable> elements) {
    exceptionStackItems = new ArrayDeque<ExceptionStackItem>(createExceptionStackFrom(elements));
    init();
}

49. LengthBatchView#sendBatch()

Project: esper
Source File: LengthBatchView.java
View license
/**
     * This method updates child views and clears the batch of events.
     */
protected void sendBatch() {
    // If there are child views and the batch was filled, fireStatementStopped update method
    if (this.hasViews()) {
        // Convert to object arrays
        EventBean[] newData = null;
        EventBean[] oldData = null;
        if (!currentBatch.isEmpty()) {
            newData = currentBatch.toArray(new EventBean[currentBatch.size()]);
        }
        if ((lastBatch != null) && (!lastBatch.isEmpty())) {
            oldData = lastBatch.toArray(new EventBean[lastBatch.size()]);
        }
        // update view buffer to serve expressions require access to events held
        if (viewUpdatedCollection != null) {
            viewUpdatedCollection.update(newData, oldData);
        }
        // Post new data (current batch) and old data (prior batch)
        if ((newData != null) || (oldData != null)) {
            if (InstrumentationHelper.ENABLED) {
                InstrumentationHelper.get().qViewIndicate(this, lengthBatchViewFactory.getViewName(), newData, oldData);
            }
            updateChildren(newData, oldData);
            if (InstrumentationHelper.ENABLED) {
                InstrumentationHelper.get().aViewIndicate();
            }
        }
    }
    lastBatch = currentBatch;
    currentBatch = new ArrayDeque<EventBean>();
}

50. TimeBatchView#sendBatch()

Project: esper
Source File: TimeBatchView.java
View license
/**
     * This method updates child views and clears the batch of events.
     * We schedule a new callback at this time if there were events in the batch.
     */
protected void sendBatch() {
    isCallbackScheduled = false;
    // If there are child views and the batch was filled, fireStatementStopped update method
    if (this.hasViews()) {
        // Convert to object arrays
        EventBean[] newData = null;
        EventBean[] oldData = null;
        if (!currentBatch.isEmpty()) {
            newData = currentBatch.toArray(new EventBean[currentBatch.size()]);
        }
        if ((lastBatch != null) && (!lastBatch.isEmpty())) {
            oldData = lastBatch.toArray(new EventBean[lastBatch.size()]);
        }
        // Post new data (current batch) and old data (prior batch)
        if (viewUpdatedCollection != null) {
            viewUpdatedCollection.update(newData, oldData);
        }
        if ((newData != null) || (oldData != null) || (isForceOutput)) {
            if (InstrumentationHelper.ENABLED) {
                InstrumentationHelper.get().qViewIndicate(this, timeBatchViewFactory.getViewName(), newData, oldData);
            }
            updateChildren(newData, oldData);
            if (InstrumentationHelper.ENABLED) {
                InstrumentationHelper.get().aViewIndicate();
            }
        }
    }
    // such as to not waste resources when no events arrive.
    if ((!currentBatch.isEmpty()) || ((lastBatch != null) && (!lastBatch.isEmpty())) || (isForceOutput)) {
        scheduleCallback();
        isCallbackScheduled = true;
    }
    lastBatch = currentBatch;
    currentBatch = new ArrayDeque<EventBean>();
}

51. ArrayDequeTest#testConstructor6()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * Deque contains all elements of collection used to initialize
     */
public void testConstructor6() {
    Integer[] ints = new Integer[SIZE];
    for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i);
    ArrayDeque q = new ArrayDeque(Arrays.asList(ints));
    for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.pollFirst());
}

52. ArrayDequeTest#testSize()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * size changes when elements added and removed
     */
public void testSize() {
    ArrayDeque q = populatedDeque(SIZE);
    for (int i = 0; i < SIZE; ++i) {
        assertEquals(SIZE - i, q.size());
        q.removeFirst();
    }
    for (int i = 0; i < SIZE; ++i) {
        assertEquals(i, q.size());
        q.add(new Integer(i));
    }
}

53. ArrayDequeTest#testPushNull()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * push(null) throws NPE
     */
public void testPushNull() {
    ArrayDeque q = new ArrayDeque(1);
    try {
        q.push(null);
        shouldThrow();
    } catch (NullPointerException success) {
    }
}

54. ArrayDequeTest#testPop()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * pop() removes next element, or throws NSEE if empty
     */
public void testPop() {
    ArrayDeque q = populatedDeque(SIZE);
    for (int i = 0; i < SIZE; ++i) {
        assertEquals(i, q.pop());
    }
    try {
        q.pop();
        shouldThrow();
    } catch (NoSuchElementException success) {
    }
}

55. ArrayDequeTest#testOfferNull()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * offer(null) throws NPE
     */
public void testOfferNull() {
    ArrayDeque q = new ArrayDeque();
    try {
        q.offer(null);
        shouldThrow();
    } catch (NullPointerException success) {
    }
}

56. ArrayDequeTest#testOfferFirstNull()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * offerFirst(null) throws NPE
     */
public void testOfferFirstNull() {
    ArrayDeque q = new ArrayDeque();
    try {
        q.offerFirst(null);
        shouldThrow();
    } catch (NullPointerException success) {
    }
}

57. ArrayDequeTest#testOfferLastNull()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * offerLast(null) throws NPE
     */
public void testOfferLastNull() {
    ArrayDeque q = new ArrayDeque();
    try {
        q.offerLast(null);
        shouldThrow();
    } catch (NullPointerException success) {
    }
}

58. ArrayDequeTest#testOffer()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * offer(x) succeeds
     */
public void testOffer() {
    ArrayDeque q = new ArrayDeque();
    assertTrue(q.offer(zero));
    assertTrue(q.offer(one));
    assertSame(zero, q.peekFirst());
    assertSame(one, q.peekLast());
}

59. ArrayDequeTest#testOfferFirst()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * offerFirst(x) succeeds
     */
public void testOfferFirst() {
    ArrayDeque q = new ArrayDeque();
    assertTrue(q.offerFirst(zero));
    assertTrue(q.offerFirst(one));
    assertSame(one, q.peekFirst());
    assertSame(zero, q.peekLast());
}

60. ArrayDequeTest#testOfferLast()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * offerLast(x) succeeds
     */
public void testOfferLast() {
    ArrayDeque q = new ArrayDeque();
    assertTrue(q.offerLast(zero));
    assertTrue(q.offerLast(one));
    assertSame(zero, q.peekFirst());
    assertSame(one, q.peekLast());
}

61. ArrayDequeTest#testAddNull()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * add(null) throws NPE
     */
public void testAddNull() {
    ArrayDeque q = new ArrayDeque();
    try {
        q.add(null);
        shouldThrow();
    } catch (NullPointerException success) {
    }
}

62. ArrayDequeTest#testAddFirstNull()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * addFirst(null) throws NPE
     */
public void testAddFirstNull() {
    ArrayDeque q = new ArrayDeque();
    try {
        q.addFirst(null);
        shouldThrow();
    } catch (NullPointerException success) {
    }
}

63. ArrayDequeTest#testAddLastNull()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * addLast(null) throws NPE
     */
public void testAddLastNull() {
    ArrayDeque q = new ArrayDeque();
    try {
        q.addLast(null);
        shouldThrow();
    } catch (NullPointerException success) {
    }
}

64. ArrayDequeTest#testAdd()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * add(x) succeeds
     */
public void testAdd() {
    ArrayDeque q = new ArrayDeque();
    assertTrue(q.add(zero));
    assertTrue(q.add(one));
    assertSame(zero, q.peekFirst());
    assertSame(one, q.peekLast());
}

65. ArrayDequeTest#testAddAll1()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * addAll(null) throws NPE
     */
public void testAddAll1() {
    ArrayDeque q = new ArrayDeque();
    try {
        q.addAll(null);
        shouldThrow();
    } catch (NullPointerException success) {
    }
}

66. ArrayDequeTest#testAddAll2()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * addAll of a collection with null elements throws NPE
     */
public void testAddAll2() {
    ArrayDeque q = new ArrayDeque();
    try {
        q.addAll(Arrays.asList(new Integer[SIZE]));
        shouldThrow();
    } catch (NullPointerException success) {
    }
}

67. ArrayDequeTest#testAddAll3()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * addAll of a collection with any null elements throws NPE after
     * possibly adding some elements
     */
public void testAddAll3() {
    ArrayDeque q = new ArrayDeque();
    Integer[] ints = new Integer[SIZE];
    for (int i = 0; i < SIZE - 1; ++i) ints[i] = new Integer(i);
    try {
        q.addAll(Arrays.asList(ints));
        shouldThrow();
    } catch (NullPointerException success) {
    }
}

68. ArrayDequeTest#testAddAll5()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * Deque contains all elements, in traversal order, of successful addAll
     */
public void testAddAll5() {
    Integer[] empty = new Integer[0];
    Integer[] ints = new Integer[SIZE];
    for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i);
    ArrayDeque q = new ArrayDeque();
    assertFalse(q.addAll(Arrays.asList(empty)));
    assertTrue(q.addAll(Arrays.asList(ints)));
    for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.pollFirst());
}

69. ArrayDequeTest#testPollFirst()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * pollFirst() succeeds unless empty
     */
public void testPollFirst() {
    ArrayDeque q = populatedDeque(SIZE);
    for (int i = 0; i < SIZE; ++i) {
        assertEquals(i, q.pollFirst());
    }
    assertNull(q.pollFirst());
}

70. ArrayDequeTest#testPollLast()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * pollLast() succeeds unless empty
     */
public void testPollLast() {
    ArrayDeque q = populatedDeque(SIZE);
    for (int i = SIZE - 1; i >= 0; --i) {
        assertEquals(i, q.pollLast());
    }
    assertNull(q.pollLast());
}

71. ArrayDequeTest#testPoll()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * poll() succeeds unless empty
     */
public void testPoll() {
    ArrayDeque q = populatedDeque(SIZE);
    for (int i = 0; i < SIZE; ++i) {
        assertEquals(i, q.poll());
    }
    assertNull(q.poll());
}

72. ArrayDequeTest#testRemove()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * remove() removes next element, or throws NSEE if empty
     */
public void testRemove() {
    ArrayDeque q = populatedDeque(SIZE);
    for (int i = 0; i < SIZE; ++i) {
        assertEquals(i, q.remove());
    }
    try {
        q.remove();
        shouldThrow();
    } catch (NoSuchElementException success) {
    }
}

73. ArrayDequeTest#testPeekFirst()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * peekFirst() returns next element, or null if empty
     */
public void testPeekFirst() {
    ArrayDeque q = populatedDeque(SIZE);
    for (int i = 0; i < SIZE; ++i) {
        assertEquals(i, q.peekFirst());
        assertEquals(i, q.pollFirst());
        assertTrue(q.peekFirst() == null || !q.peekFirst().equals(i));
    }
    assertNull(q.peekFirst());
}

74. ArrayDequeTest#testPeek()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * peek() returns next element, or null if empty
     */
public void testPeek() {
    ArrayDeque q = populatedDeque(SIZE);
    for (int i = 0; i < SIZE; ++i) {
        assertEquals(i, q.peek());
        assertEquals(i, q.poll());
        assertTrue(q.peek() == null || !q.peek().equals(i));
    }
    assertNull(q.peek());
}

75. ArrayDequeTest#testPeekLast()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * peekLast() returns next element, or null if empty
     */
public void testPeekLast() {
    ArrayDeque q = populatedDeque(SIZE);
    for (int i = SIZE - 1; i >= 0; --i) {
        assertEquals(i, q.peekLast());
        assertEquals(i, q.pollLast());
        assertTrue(q.peekLast() == null || !q.peekLast().equals(i));
    }
    assertNull(q.peekLast());
}

76. ArrayDequeTest#testElement()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * element() returns first element, or throws NSEE if empty
     */
public void testElement() {
    ArrayDeque q = populatedDeque(SIZE);
    for (int i = 0; i < SIZE; ++i) {
        assertEquals(i, q.element());
        assertEquals(i, q.poll());
    }
    try {
        q.element();
        shouldThrow();
    } catch (NoSuchElementException success) {
    }
}

77. ArrayDequeTest#testFirstElement()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * getFirst() returns first element, or throws NSEE if empty
     */
public void testFirstElement() {
    ArrayDeque q = populatedDeque(SIZE);
    for (int i = 0; i < SIZE; ++i) {
        assertEquals(i, q.getFirst());
        assertEquals(i, q.pollFirst());
    }
    try {
        q.getFirst();
        shouldThrow();
    } catch (NoSuchElementException success) {
    }
}

78. ArrayDequeTest#testRemoveFirst()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * removeFirst() removes first element, or throws NSEE if empty
     */
public void testRemoveFirst() {
    ArrayDeque q = populatedDeque(SIZE);
    for (int i = 0; i < SIZE; ++i) {
        assertEquals(i, q.removeFirst());
    }
    try {
        q.removeFirst();
        shouldThrow();
    } catch (NoSuchElementException success) {
    }
    assertNull(q.peekFirst());
}

79. ArrayDequeTest#testRemoveLast()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * removeLast() removes last element, or throws NSEE if empty
     */
public void testRemoveLast() {
    ArrayDeque q = populatedDeque(SIZE);
    for (int i = SIZE - 1; i >= 0; --i) {
        assertEquals(i, q.removeLast());
    }
    try {
        q.removeLast();
        shouldThrow();
    } catch (NoSuchElementException success) {
    }
    assertNull(q.peekLast());
}

80. ArrayDequeTest#testRemoveFirstOccurrence()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * removeFirstOccurrence(x) removes x and returns true if present
     */
public void testRemoveFirstOccurrence() {
    ArrayDeque q = populatedDeque(SIZE);
    for (int i = 1; i < SIZE; i += 2) {
        assertTrue(q.removeFirstOccurrence(new Integer(i)));
    }
    for (int i = 0; i < SIZE; i += 2) {
        assertTrue(q.removeFirstOccurrence(new Integer(i)));
        assertFalse(q.removeFirstOccurrence(new Integer(i + 1)));
    }
    assertTrue(q.isEmpty());
}

81. ArrayDequeTest#testRemoveLastOccurrence()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * removeLastOccurrence(x) removes x and returns true if present
     */
public void testRemoveLastOccurrence() {
    ArrayDeque q = populatedDeque(SIZE);
    for (int i = 1; i < SIZE; i += 2) {
        assertTrue(q.removeLastOccurrence(new Integer(i)));
    }
    for (int i = 0; i < SIZE; i += 2) {
        assertTrue(q.removeLastOccurrence(new Integer(i)));
        assertFalse(q.removeLastOccurrence(new Integer(i + 1)));
    }
    assertTrue(q.isEmpty());
}

82. ArrayDequeTest#testContains()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * contains(x) reports true when elements added but not yet removed
     */
public void testContains() {
    ArrayDeque q = populatedDeque(SIZE);
    for (int i = 0; i < SIZE; ++i) {
        assertTrue(q.contains(new Integer(i)));
        assertEquals(i, q.pollFirst());
        assertFalse(q.contains(new Integer(i)));
    }
}

83. ArrayDequeTest#testIterator()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * Iterator iterates through all elements
     */
public void testIterator() {
    ArrayDeque q = populatedDeque(SIZE);
    Iterator it = q.iterator();
    int i;
    for (i = 0; it.hasNext(); i++) assertTrue(q.contains(it.next()));
    assertEquals(i, SIZE);
    assertIteratorExhausted(it);
}

84. ArrayDequeTest#testToString()

Project: mapdb
Source File: ArrayDequeTest.java
View license
/**
     * toString() contains toStrings of elements
     */
public void testToString() {
    ArrayDeque q = populatedDeque(SIZE);
    String s = q.toString();
    for (int i = 0; i < SIZE; ++i) {
        assertTrue(s.contains(String.valueOf(i)));
    }
}

85. ArrayDequeTest#testConstructor6()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * Deque contains all elements of collection used to initialize
     */
public void testConstructor6() {
    Integer[] ints = new Integer[SIZE];
    for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i);
    ArrayDeque q = new ArrayDeque(Arrays.asList(ints));
    for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.pollFirst());
}

86. ArrayDequeTest#testSize()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * size changes when elements added and removed
     */
public void testSize() {
    ArrayDeque q = populatedDeque(SIZE);
    for (int i = 0; i < SIZE; ++i) {
        assertEquals(SIZE - i, q.size());
        q.removeFirst();
    }
    for (int i = 0; i < SIZE; ++i) {
        assertEquals(i, q.size());
        q.add(new Integer(i));
    }
}

87. ArrayDequeTest#testPushNull()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * push(null) throws NPE
     */
public void testPushNull() {
    ArrayDeque q = new ArrayDeque(1);
    try {
        q.push(null);
        shouldThrow();
    } catch (NullPointerException success) {
    }
}

88. ArrayDequeTest#testPop()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * pop() removes next element, or throws NSEE if empty
     */
public void testPop() {
    ArrayDeque q = populatedDeque(SIZE);
    for (int i = 0; i < SIZE; ++i) {
        assertEquals(i, q.pop());
    }
    try {
        q.pop();
        shouldThrow();
    } catch (NoSuchElementException success) {
    }
}

89. ArrayDequeTest#testOfferNull()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * offer(null) throws NPE
     */
public void testOfferNull() {
    ArrayDeque q = new ArrayDeque();
    try {
        q.offer(null);
        shouldThrow();
    } catch (NullPointerException success) {
    }
}

90. ArrayDequeTest#testOfferFirstNull()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * offerFirst(null) throws NPE
     */
public void testOfferFirstNull() {
    ArrayDeque q = new ArrayDeque();
    try {
        q.offerFirst(null);
        shouldThrow();
    } catch (NullPointerException success) {
    }
}

91. ArrayDequeTest#testOfferLastNull()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * offerLast(null) throws NPE
     */
public void testOfferLastNull() {
    ArrayDeque q = new ArrayDeque();
    try {
        q.offerLast(null);
        shouldThrow();
    } catch (NullPointerException success) {
    }
}

92. ArrayDequeTest#testOffer()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * offer(x) succeeds
     */
public void testOffer() {
    ArrayDeque q = new ArrayDeque();
    assertTrue(q.offer(zero));
    assertTrue(q.offer(one));
    assertSame(zero, q.peekFirst());
    assertSame(one, q.peekLast());
}

93. ArrayDequeTest#testOfferFirst()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * offerFirst(x) succeeds
     */
public void testOfferFirst() {
    ArrayDeque q = new ArrayDeque();
    assertTrue(q.offerFirst(zero));
    assertTrue(q.offerFirst(one));
    assertSame(one, q.peekFirst());
    assertSame(zero, q.peekLast());
}

94. ArrayDequeTest#testOfferLast()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * offerLast(x) succeeds
     */
public void testOfferLast() {
    ArrayDeque q = new ArrayDeque();
    assertTrue(q.offerLast(zero));
    assertTrue(q.offerLast(one));
    assertSame(zero, q.peekFirst());
    assertSame(one, q.peekLast());
}

95. ArrayDequeTest#testAddNull()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * add(null) throws NPE
     */
public void testAddNull() {
    ArrayDeque q = new ArrayDeque();
    try {
        q.add(null);
        shouldThrow();
    } catch (NullPointerException success) {
    }
}

96. ArrayDequeTest#testAddFirstNull()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * addFirst(null) throws NPE
     */
public void testAddFirstNull() {
    ArrayDeque q = new ArrayDeque();
    try {
        q.addFirst(null);
        shouldThrow();
    } catch (NullPointerException success) {
    }
}

97. ArrayDequeTest#testAddLastNull()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * addLast(null) throws NPE
     */
public void testAddLastNull() {
    ArrayDeque q = new ArrayDeque();
    try {
        q.addLast(null);
        shouldThrow();
    } catch (NullPointerException success) {
    }
}

98. ArrayDequeTest#testAdd()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * add(x) succeeds
     */
public void testAdd() {
    ArrayDeque q = new ArrayDeque();
    assertTrue(q.add(zero));
    assertTrue(q.add(one));
    assertSame(zero, q.peekFirst());
    assertSame(one, q.peekLast());
}

99. ArrayDequeTest#testAddAll1()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * addAll(null) throws NPE
     */
public void testAddAll1() {
    ArrayDeque q = new ArrayDeque();
    try {
        q.addAll(null);
        shouldThrow();
    } catch (NullPointerException success) {
    }
}

100. ArrayDequeTest#testAddAll2()

Project: openjdk
Source File: ArrayDequeTest.java
View license
/**
     * addAll of a collection with null elements throws NPE
     */
public void testAddAll2() {
    ArrayDeque q = new ArrayDeque();
    try {
        q.addAll(Arrays.asList(new Integer[SIZE]));
        shouldThrow();
    } catch (NullPointerException success) {
    }
}