Package java.util

Examples of java.util.Deque


        Integer testInt[] = new Integer[100];
        Integer test101 = new Integer(101);
        for (int i = 0; i < testInt.length; i++) {
            testInt[i] = new Integer(i);
        }   
        Deque deque = new ArrayDeque<Integer>();
        Queue<Integer> que = Collections.asLifoQueue(deque);
        for (int i = 0; i < testInt.length; i++) {
            que.add(testInt[i]);
        }       
        assertEquals(100, deque.size());
        assertEquals(100, que.size());
        for (int i = testInt.length-1; i >=0 ; i--) {
            assertEquals(testInt[i], deque.pop());
        }               
        assertEquals(0, deque.size());
        assertEquals(0, que.size());
        for (int i = 0; i < testInt.length; i++) {
            deque.push(testInt[i]);
        }       
        assertEquals(100, deque.size());
        assertEquals(100, que.size());
        Collection col = new LinkedList<Integer>();
        col.add(test101);
        que.addAll(col);
        assertEquals(test101, que.remove());
        for (int i = testInt.length-1; i >=0 ; i--) {
            assertEquals(testInt[i], que.remove());
        }         
        assertEquals(0, deque.size());
        assertEquals(0, que.size());
    }
View Full Code Here


        Integer testInt[] = new Integer[100];
        Integer test101 = new Integer(101);
        for (int i = 0; i < testInt.length; i++) {
            testInt[i] = new Integer(i);
        }   
        Deque deque = new ArrayDeque<Integer>();
        Queue<Integer> que = Collections.asLifoQueue(deque);
        for (int i = 0; i < testInt.length; i++) {
            que.add(testInt[i]);
        }       
        SerializationTest.verifySelf(que, new SerializableAssert(){
View Full Code Here

        Integer testInt[] = new Integer[100];
        Integer test101 = new Integer(101);
        for (int i = 0; i < testInt.length; i++) {
            testInt[i] = new Integer(i);
        }   
        Deque deque = new ArrayDeque<Integer>();
        Queue<Integer> que = Collections.asLifoQueue(deque);
        for (int i = 0; i < testInt.length; i++) {
            que.add(testInt[i]);
        }       
        Queue deserQue = (Queue)SerializationTester.readObject(que, "serialization/java/util/Collections_asLifoQueue.golden.ser");
View Full Code Here

        if (target.isEmpty()) {
            return target;
        }

        Collection<EventBean> beans = (Collection<EventBean>) target;
        Deque queue = new ArrayDeque();
        for (EventBean next : beans) {
            eventsLambda[streamNumLambda] = next;

            Object item = innerExpression.evaluate(eventsLambda, isNewData, context);
            if (item != null) {
                queue.add(item);
            }
        }

        return queue;
    }
View Full Code Here

    */
   private Deque getField(int tag) {
      if (tag == 0) {
         throw new IllegalArgumentException("Zero is not a valid tag number");
      }
      Deque field = null;
      if (fields == null) {
         fields = new HashMap<Integer, Deque>();
      } else {
         field = fields.get(tag);
      }
View Full Code Here

        if (target.isEmpty()) {
            return target;
        }

        Collection<EventBean> beans = (Collection<EventBean>) target;
        Deque queue = new ArrayDeque();
        for (EventBean next : beans) {
            eventsLambda[streamNumLambda] = next;

            Object item = innerExpression.evaluate(eventsLambda, isNewData, context);
            if (item != null) {
                queue.add(item);
            }
        }

        return queue;
    }
View Full Code Here

            return target;
        }

        ObjectArrayEventBean resultEvent = new ObjectArrayEventBean(new Object[1], resultEventType);
        Collection<Object> values = (Collection<Object>) target;
        Deque queue = new ArrayDeque();
        for (Object next : values) {

            resultEvent.getProperties()[0] = next;
            eventsLambda[streamNumLambda] = resultEvent;

            Object item = innerExpression.evaluate(eventsLambda, isNewData, context);
            if (item != null) {
                queue.add(item);
            }
        }

        return queue;
    }
View Full Code Here

TOP

Related Classes of java.util.Deque

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.